Created a new Webapp, one button, this is the “MouseEnter”-event.
Dim menu As New WebMenuItem
menu.Append(New WebMenuItem(“One”))
menu.Append(New WebMenuItem(“Two”))
menu.Append(New WebMenuItem(“Three”))
Me.ContextualMenu = menu
me.PresentContextualMenu
Fired it up, moved the mouse over the control, no menu, just silence. The code does run though, what’s up there?
Xojo 2016r1.1, Safari 9.1.1
I guess the menu is not yet created when it’s supposed to be displayed.
Move the menu creating code to the Open event instead(menu as a property) and only display it on MouseEnter and see what happens.
Open:
menu = New WebMenuItem
menu.Append(New WebMenuItem("One"))
menu.Append(New WebMenuItem("Two"))
menu.Append(New WebMenuItem("Three"))
Me.ContextualMenu = menu
MouseEnter:
me.PresentContextualMenu
Ah…actually the open event didn’t work (I get one of those mysterious javascript errors: Could not execute returned javascript: undefined is not an object (evaluating ‘Xojo.controls[‘Pl5KSSuM’].setAutoDisable’)), but it does work if I use the shown event to populate the Contextual-Menu. Will train myself to “feel” what objects might or might not have been created in time before calling any methods on them. Thanks!