I am working on customizing a menu. One of the menu choices is called Favorites, and you can have up to 9 favorite items in this submenu. I have a function that will rename the 9 items and make them visible (if you only have 6 then only 6 are visible). Your favorite is stored in an array that contains the menu option you want to select.
For example, variable gm_menu_favs[1] = m_mdi_frame.m_report.m_all_sales. The menu text Favorites\Favorite1 has been changed to Sales Report.
When Favorites\Sales Report is selected, in the clicked event I want to execute this script.
gm_menu_favs[1].triggerevent(Clicked!)
however this will not work as it says "Invalid operand type for Dot operator:string
Makes sense, but how do I create a menu object and identifiy the menu item I want to trigger?
this also does not work.
menu lm_this
lm_this = this
lm_this.gs_menu_favs[1].triggerevent(Clicked!)
Thanks
gm_menu_fav[1].triggerevent(Clicked!)
The variable is the a string array.
I figured this out and will post how I did it for the next person but I would love to know why something like this is so difficult.
But you can't have the menu item name in a string variable and use the menu item directly by its name.
What you can do: Use the Item property of a menu to get its child items. So you can find a item by its classname.
e.g.
FOR ll_menu = 1 TO UpperBound (lm_current.Item)
IF lm_current.Item [ll_menu].Classname() = "m_fav1" THEN
...
END IF
NEXT