Help : Create dynamic menu from Database

Help : Create dynamic menu from Database

Postby anserkk » 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 ?




Code: Select all  Expand view

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
User avatar
anserkk
 
Posts: 1329
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Postby Antonio Linares » 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
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby anserkk » Tue Dec 02, 2008 4: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
User avatar
anserkk
 
Posts: 1329
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 98 guests