Dynamic Menu Creation based on Table Information

Could anyone assist me please…

I would like to create dynamic menu’s based on a user authority in a browse screen.

I store the menu item text in a table as well as the users login id, and want to use this as the basis for what menu options are available to a user at runtime.

I have managed to create the menu items (by statically assigning a menubar as well as a menu to the browse), but I am unsure how best to handle trapping what has been selected and then executing appropriate procedures within the window.

Any assistance would be greatly appreciated.

G

Posting your actual code helps. You did a ItemFEQ=CREATE(0,Create:Item,?Menu )?

if yes that returned an FEQ of the item. You’ll need to store that in a Queue or something. In the CASE Accepted() ELSE you can check if the Accepted() FEQ is in your Queue and call your desired procedure.

1 Like

Thank you Carl.

That has been a great help.

I now have my code written that allows me to do this.
I created a Queue which contains the text of the menu item and the Accepted() value which is perfect.

Now I want to do it in generic procedure that I am going to call from all windows after they initialize to load the user-defined menu items.

The problem is that I am battling to pass a queue variable to the sub-process and then get the value back.

My code looks like

Window_Optional_Menu_Create(MenuQueue,‘CLIENT_SCREEN’,?ThisWindow_Options_MENU)

The prototype of the abovementioned procedure is:
(*QUEUE MenuQueue, STRING ScreenName, LONG MenuID)

I have found that the changes that I make in the subroutine are not returned to the calling procedure.

Is there a trick with this?

I have written a separate procedure that

Changes to what? The Queue?

Paste the Queue declaration?

To modify the passed queue can be done a few ways.

  • Prototype it as a Named Type Queue, most formal probably best
  • Pass the Queue fields that need change by *Address
  • Local Group that matches Queue