I have added a menu bar item to the menubar in my main window of my .exe.
I cannot however, find where to add the action event, when the user clicks on that menu item?
It is obviously something simple, but have now spent for ever looking at the Language Reference, and still can’t work it out
Can someone please help.
You add Menu Handlers to whatever project item is appropriate
Say you have a “New Document” item in your menu bar - that probably should be handled by the App class so you could have the app NOT have a document open & create one (this mostly applies on OS X where you can have an app running with no documents open)
A “Print” menu item handler should probably be added to the window as it doesn’t make a lot of sense to have a Print option when you don’t have a document.
See Xojo User Guide - Book 2
The LR is really when you already know HOW to do all this stuff and need the short hand reference.
It’s definitely not a learning guide
The PDF user guides are designed for this and are right next to the IDE in the Documentation folder or accessible from the Main Menu
It’s very simple. Create a Toolbar with the name “MyOwnTB”, give each item in the Toolbar a short name. Add the Toolbar to a window. Goto “Controls => MyOwnToolbar” in the current window. Add these lines to the new event “Action”:
Select case item.Name
If you whish, you can set some parameter to your ToolbarMenu in the “open” event.
dim MyTB as Toolbutton
MyTB = Toolbar11.tbStartCC
MyTB.Caption = langtbStartCCCaption
MyTB.HelpTag = langtbStartCCHelpTag
MyTB.icon = MyOwnIcon
Thanks Norman and Horst,
One last question - Is it normal for Windows software to display menu items off to the left of the main window?
I thought from memory, that when a user clicked on the menu bar, the drop down choices were left justified, but my menu bar items are displayed right justified, and the beginning of each choice extends out to the left of my main window?
Hope that made sense - Basically, when a user clicks on the menu bar, the choices extend out to the left of my main window into the desktop space (as opposed to being contained within the window).