Hi.
I would like to dynamical add menuitem to a menubar in VL WEB. I have a list of groups from a table that i would like to create as menuitems. And when clicked send the value of the group to the selection of items.
is it possible?
/kno
dynamic add menuitem to menubar in VL WEB
Re: dynamic add menuitem to menubar in VL WEB
Hi,
Create a collection of menu items:
Define_Com Class(#Prim_acol<#Prim_Md.MenuItem>) Name(#MenuItems)
Then as you instantiate new items you add them to the collection, for example:
Define_Com Class(#Prim_Md.MenuItem) Name(#TempItem) Reference(*DYNAMIC)
#TempItem <= (*New #Prim_Md.MenuItem)
Set Com(#TempItem) Parent(#Menu) Caption("Caption Item 1") Displayposition(1) ... etc
#MenuItems.Insert Item(#TempItem)
Create a collection of menu items:
Define_Com Class(#Prim_acol<#Prim_Md.MenuItem>) Name(#MenuItems)
Then as you instantiate new items you add them to the collection, for example:
Define_Com Class(#Prim_Md.MenuItem) Name(#TempItem) Reference(*DYNAMIC)
#TempItem <= (*New #Prim_Md.MenuItem)
Set Com(#TempItem) Parent(#Menu) Caption("Caption Item 1") Displayposition(1) ... etc
#MenuItems.Insert Item(#TempItem)
Re: dynamic add menuitem to menubar in VL WEB
Hi.
It worked - thanks.
If I want to add a dynamic click on the menu item, how do I do that?
If i want to send a variable with the menuitem so when click it sends the value with the click, how do I do that
It worked - thanks.
If I want to add a dynamic click on the menu item, how do I do that?
If i want to send a variable with the menuitem so when click it sends the value with the click, how do I do that
Re: dynamic add menuitem to menubar in VL WEB
Hi,
You can set the ComponentTag property when you create the item:
Set Com(#TempItem) Parent(#Menu) Caption("Caption Item 1") Displayposition(1) ComponentTag("Item1")
Using the collection from my earlier reply, the way to monitor the click event is like this where the Com_Sender is a reference to the clicked menu item:
Evtroutine Handling(#MenuItems<>.Click) Com_Sender(#ClickedItem)
#sys_web.alert Caption(#ClickedItem.ComponentTag)
Endroutine
You can set the ComponentTag property when you create the item:
Set Com(#TempItem) Parent(#Menu) Caption("Caption Item 1") Displayposition(1) ComponentTag("Item1")
Using the collection from my earlier reply, the way to monitor the click event is like this where the Com_Sender is a reference to the clicked menu item:
Evtroutine Handling(#MenuItems<>.Click) Com_Sender(#ClickedItem)
#sys_web.alert Caption(#ClickedItem.ComponentTag)
Endroutine