L le_toubib Active Member Licensed User Longtime User Jun 21, 2019 #1 hi all is there a way to detect the menu_Click event ??? not the menubar not the menu items .. just the title itself.
hi all is there a way to detect the menu_Click event ??? not the menubar not the menu items .. just the title itself.
Daestrum Expert Licensed User Longtime User Jun 21, 2019 #2 You can add an event to capture the 'OnShowing" event Code: Copy Dim theMenu As JavaObject = theRealMenu ' this bit was missing Dim e As Object = theMenu.CreateEvent("javafx.event.EventHandler","menuTitleClick",False) theMenu.RunMethod("setOnShowing",Array(e) ... Sub menuTitleClick_Event(MethodName As String, Args() As Object) Log(Args(0)) End Sub ... Last edited: Jun 21, 2019 Upvote 0
You can add an event to capture the 'OnShowing" event Code: Copy Dim theMenu As JavaObject = theRealMenu ' this bit was missing Dim e As Object = theMenu.CreateEvent("javafx.event.EventHandler","menuTitleClick",False) theMenu.RunMethod("setOnShowing",Array(e) ... Sub menuTitleClick_Event(MethodName As String, Args() As Object) Log(Args(0)) End Sub ...
Didier9 Well-Known Member Licensed User Longtime User Jun 21, 2019 #3 Daestrum said: You can add an event to capture the 'OnShowing" event Code: Copy Dim theMenu As JavaObject Dim e As Object = theMenu.CreateEvent("javafx.event.EventHandler","menuTitleClick",False) theMenu.RunMethod("setOnShowing",Array(e) ... Sub menuTitleClick_Event(MethodName As String, Args() As Object) Log(Args(0)) End Sub ... Click to expand... This is interesting for something I am working on but... The first problem is that java wants the theMenu JavaObject to be initialized, but there is no "Initialize" method, instead there are 3 different Initialize... methods and I do not know which to use or how to set it... Then I do not understand how to associate the JavaObject to a menu bar or a menu. Assume that my menu is declared as follows: Code: Copy ' create menu bar mb.Initialize( "MenuBar" ) MainForm.RootPane.AddNode( mb, 0, 0, -1, -1 ) ' Add top level File menu to menu bar Dim FileMenu As Menu FileMenu.Initialize( "File", "" ) mb.Menus.Add( FileMenu ) How do I detect the user clicking on "File" for instance? Upvote 0
Daestrum said: You can add an event to capture the 'OnShowing" event Code: Copy Dim theMenu As JavaObject Dim e As Object = theMenu.CreateEvent("javafx.event.EventHandler","menuTitleClick",False) theMenu.RunMethod("setOnShowing",Array(e) ... Sub menuTitleClick_Event(MethodName As String, Args() As Object) Log(Args(0)) End Sub ... Click to expand... This is interesting for something I am working on but... The first problem is that java wants the theMenu JavaObject to be initialized, but there is no "Initialize" method, instead there are 3 different Initialize... methods and I do not know which to use or how to set it... Then I do not understand how to associate the JavaObject to a menu bar or a menu. Assume that my menu is declared as follows: Code: Copy ' create menu bar mb.Initialize( "MenuBar" ) MainForm.RootPane.AddNode( mb, 0, 0, -1, -1 ) ' Add top level File menu to menu bar Dim FileMenu As Menu FileMenu.Initialize( "File", "" ) mb.Menus.Add( FileMenu ) How do I detect the user clicking on "File" for instance?
Daestrum Expert Licensed User Longtime User Jun 21, 2019 #4 Sorry, had a brain phart and forgot to add the menu to the javaobject dim line. Code: Copy ' after you have defined FileMenu Dim theMenu As JavaObject = FileMenu Dim e As Object = theMenu.CreateEvent("javafx.event.EventHandler","menuTitleClick",False) theMenu.RunMethod("setOnShowing",Array(e) ... Sub menuTitleClick_Event(MethodName As String, Args() As Object) Log(Args(0)) End Sub ... Upvote 0
Sorry, had a brain phart and forgot to add the menu to the javaobject dim line. Code: Copy ' after you have defined FileMenu Dim theMenu As JavaObject = FileMenu Dim e As Object = theMenu.CreateEvent("javafx.event.EventHandler","menuTitleClick",False) theMenu.RunMethod("setOnShowing",Array(e) ... Sub menuTitleClick_Event(MethodName As String, Args() As Object) Log(Args(0)) End Sub ...