Re: wxEuphoria: Using wxEVT_ACTIVATE_APP
- Posted by ghaberek (admin) Jul 18, 2018
- 1061 views
euphoric said...
Is there an event that fires only once upon app start?
I'm looking at the wxEVT_ACTIVATE_APP event, but not sure how to use it. It doesn't seem to work with my main frame:
set_event_handler( myFrame, -1, wxEVT_ACTIVATE_APP, routine_id("app_activate"))
The verbiage of "app" here is ambiguous. According to the documentation, it's meant to trigger wxActivateEvent events against the wxApp class, instead of the wxWindow class.
Either way, I'm pretty sure wxActivateEvent events fire off every time the window is activated or deactivated, which is similar-but-not-quite the same as focus/blurred.
If you want to fire an event once when your wxFrame is shown, I would just keep a flag and then ignore the event on further triggers.
integer app_activated = wxFalse procedure myFrame_OnShow( atom this, atom event_type, atom id, atom event ) if app_activated then skip( event ) return end if -- do activation stuff here app_activated = wxTrue end procedure set_event_handler( myFrame, -1, wxEVT_SHOW, routine_id("myFrame_OnShow") )
-Greg