FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Help : Create dynamic menu from Database
Posts: 1335
Joined: Fri Jun 13, 2008 11:04 AM
Help : Create dynamic menu from Database
Posted: Mon Dec 01, 2008 12:06 PM
Dear All,

I am trying to create a Menu based on the user Permissions from a database. Menu is getting created and is getting displayed but only the Menu action is not working.

I am keeping MenuText,MenuAction etc in the database itself. I tried different option but unfortunately Menu action is not working. I tried different options like storing the menu action into a string and then associating to menu action using &(MnuAction) making it a code block etc.

I don't know where I have went wrong. Any help ?




 cMenuAction:=alltrim(oRecSet:Fields("Menu_Action"):Value)

 // I tied the following line but not working
*   MENUITEM oRecSet:Fields("Menu_Text"):Value ACTION { || &cMenuAction }

 // I tied the following line but not working
*   MENUITEM oRecSet:Fields("Menu_Text"):Value ACTION  &(cMenuAction)

MENUITEM oMnuItem PROMPT ALLTRIM(oRecSet:Fields("Menu_Text"):Value)
            oMnuItem:bAction:={ || cMenuAction }


Result is action never get executed if I use { || cMenuAction }. No error but nothing happens

I get run time error If I try &(cMenuAction) variable does not exist cMenuAction

Regards

Anser
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Help : Create dynamic menu from Database
Posted: Mon Dec 01, 2008 12:51 PM

Anser,

Do it this way:

MENUITEM oRecSet:Fields("Menu_Text"):Value BLOCK &cMenuAction

Please review FWH\samples\TestMnu.prg

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1335
Joined: Fri Jun 13, 2008 11:04 AM
Help : Create dynamic menu from Database
Posted: Tue Dec 02, 2008 04:36 AM

Dear Mr.Antonio,

I have done as per your advice and it worked.

I went wrong because in the Database instead of keeping Menu_Action in the code block format, I kept Menu_Action as simple text ie MsgInfo("Test").

The key word BLOCK is to be used instead of ACTION

{ || MsgInfo("Test") } worked

Thanks & Regards

Anser

Continue the discussion