[quote=200528:@Ramon SASTRE]Thank you Michel,
What you say is very clear and it is exactly what I thoight.
But in this case:
- it should be clarified in Xojo documentation
- It has no sense to allow code in this event if it is not computed
In general Menus have created a lot of problems to me when trying to program both for Windows and OSX. The truth is that menu philosophy in both OS is very different! In general I try to avoid menus and use other type of controls: buttons, segmented controls…[/quote]
You are right, the philosophy is not exactly the same. One menu bar for all windows in OS X, one per window in Windows. And the fact the menu titles menu handlers do not work.
I have found, though, that the menu title click is about the only real difference in everyday use.
For the LR, Paul Lefebvre generally gracefully changes it right away when a Feedback is filed.
That said, I am not going to leave you in pain. You can nevertheless obtain execution upon menu bar title click.
Add a 20 ms multiple timer to the page.
In the Action event, add :
Sub Action()
Label1.Text = str(system.mousex)+" "+str(system.Mousey)
if system.mousey < screen(0).AvailableTop and system.mousex > 308 and system.mouseX < 362 _
and System.MouseDown then
MsgBox "click"
end if
End Sub
This will pop a MsgBox “Click” when the third menu is clicked.
You may find convenient to use this in the same timer to find the left and right of a menu title on the bar (308-362) :
Label1.Text = str(system.mousex)+" "+str(system.Mousey)
That is how I found the left and right of my third item. Note that it is a powerful method, that enables all sorts of additional tricks, like detecting a click in screen corners or elsewhere on the screen.
Finally, note that this is absolutely not conformant to the highly revered HIG (Human Interface Guidelines), so Mac OS X zealots may regard that as slightly apostatic
Could be an issue if you plan to distribute the app in the MAS.