On the line where the compiler stops there is only one method and that is the method named with the name of the menu item. The Xojo IDE / framework creates a global method for each menu item in each menu bar. I can’t think of another reason for that error message.
On Windows 7, Xojo 2013r2, in a new Desktop project in Window1, MenuBar1 is included with default Edit menu item on the menubar. While editing the “MenuBar1” in GUI, a new menu item is added under the (“Edit” menu) by using the “Toolbar” button (that has tooltip text = “Create a new item in this menu”). This new menu item is given the “Name = debug” and “Text = Debug Mode” and Enter key is pressed. Then select the Window1 from the Project tree and from Xojo menu select “Insert - Menu Handler” and from the Inspector “MenuItem Name” choose “debug” and add the following code above the instruction “Retun True”.
If debug.checked = True Then
MsgBox("Debug On")
Else
MsgBox("Debug Off")
End If
The above compiles and executes without any errors.
If you have set the menu bar and done as Syed said and it still is weird then do a restart. Best of the computer, not just Xojo.
Every few months I get some really wonky behavior and a restart usually fixes it. Bob Keeney and Christian have made similar experiences (Bob even wrote a blog post about it)
[quote=113289:@David Smith]I’ve just made a new desktop application and added in a menu item to the edit menu,
It compiles with the code;
if debug.checked=true then
msgbox("True")
end if
Return True
but it never displays the message box? no matter how many times i click it?
I am unable to make it ‘check’[/quote]
Add the following (or required) code in Window1.Open event to set the initial Checked status of the “debug” menu item.
//
// Mark MenuBar1-EditMenu-debug as Checked at startup
//
debug.Checked = True
And update the handler code for “debug” menu item as shown below to allow the toggle of “Checked” and “Unchecked” at each successive selection of this menu item by the user. Note that the “Checked” and “Unchecked” status is visible in the form of a “tick/check” symbol against the menu item when the menu GUI is open.
[code] debug.Checked = Not debug.Checked
If debug.Checked = True Then
MsgBox(“Debug On”)
Else
MsgBox(“Debug Off”)
End If
Return True[/code]
The above code compiles and executes on Windows 7, Xojo 2013r2 without any errors.