Last active 2 weeks ago
It seems like using UIEvent.OK_EVENT makes things work.
Yeah, I did have a look at that, but thank you, I think that might help, I'm gonna try and see if I can make anything work now. Thank you.
I have a problem understanding how to bind certain actions to UI Events using Lua.
Basically, I have a menu bar with different entries and those entries again have several items. I want to specify what happens for each item if it is selected (so at a Click Event).
I have looked into the c++ Version of the Code, with the handleEvents function and if-Statements checking which field was selected and so on, but I don't know how to do it using Lua.
I have managed fine to add actions to UIButtons, like so:
class "Click" (EventHandler) function Click:Click() EventHandler.EventHandler(self) end function Click:on_click_event_OkButton(e) window.hideWindow() end okButton:addEventListener(click, Click.on_click_event_OkButton, UIEvent.CLICK_EVENT)
But whenever I tried adding such a function to a MenuBarEntry or MenuBarEntryItem or just the MenuBar, it didn't work.
Could someone give me a hint in the right direction? I feel like I have already spent too much time on trying to figure this out myself.