I'm adding menu's to Gform and i have a problem
the following code works , i pass the arguments
menu name|parent to attach to|Menu Text|flags
I create the first menu using this function and give it no parent name so it attaches top level to the form
Then the next menu i pass the first menu name as the parent.
It all works , i get a menu at the top of the form and get the MENU_Click() event.
Code: Select all
Private Function makeMenu(txt As String) ' name|parent|Menu Text|flags Dim m As Menu, s As String, a As Array s = Replace(txt, "\"", "") a = Split(s, Sep) If a = "" Or a = "form" Then m = New Menu(frm) 'As "MENU" Else m = New Menu(FindMenu(a)) As "MENU" Endif m.Name = a m.Enabled = True If a.count > 2 Then m.Text = a If a.Count = 4 Then MFlags(m, a[a.Max]) End Private Sub FindMenu(n As String) As Menu Dim c, c2 As Integer For c = 0 To frm.Menus.Count - 1 If frm.Menus[c].Name = n Then Return frm.Menus[c] For c2 = 0 To frm.Menus[c].Children.Count - 1 If frm.Menus[c].Children[c2].Name = n Then Return frm.Menus[c].Children[c2] Next Next Return Null End
The problem is if i set the first top level menu .Visible setting to False and give any of the objects a .PopupMenu setting of the menu name (Like i would in the IDE) I get the popup menu okay attached to the object but it doesn't fire the MENU_Click() event
If i leave the .Visible flag as True the menu shows on both the form and on the control and i get the click event from the main menu but not the popup one on the control ?
Any help appreciated