Developer forums (C::B DEVELOPMENT STRICTLY!) > Development
Loose Focus event?
daniloz:
Is there an event that is triggered when the C::B app looses focus?
I explain myself: I'd like to write a plugin to save all changed documents whenever C::B looses focus, so I can switch between C::B and my toolchain IDE (VisualDSP++) more easily. :-)
oBFusCATed:
Look at sdk_events.h if there it isn't you could (probably) register raw wxEvent on the main window.
See here: http://docs.wxwidgets.org/stable/wx_wxactivateevent.html#wxactivateevent
daniloz:
--- Quote from: oBFusCATed on February 03, 2011, 01:20:41 pm ---Look at sdk_events.h if there it isn't you could (probably) register raw wxEvent on the main window.
See here: http://docs.wxwidgets.org/stable/wx_wxactivateevent.html#wxactivateevent
--- End quote ---
You mean, the plugin itself could (probably) register the raw wxEvent on the main window?
Wouldn't it be better to go through a cbEvent, anyway?
Pecan:
Google "Event handling overview"
--- Quote ---wxActivateEvent
An activate event is sent when a window or application is being activated or deactivated.
Derived from
wxEvent
wxObject
Include files
<wx/event.h>
Event table macros
To process an activate event, use these event handler macros to direct input to a member function that takes a wxActivateEvent argument.
EVT_ACTIVATE(func) Process a wxEVT_ACTIVATE event.
EVT_ACTIVATE_APP(func) Process a wxEVT_ACTIVATE_APP event.
EVT_HIBERNATE(func) Process a hibernate event, supplying the member function. This event applies to wxApp only, and only on Windows SmartPhone and PocketPC. It is generated when the system is low on memory; the application should free up as much memory as possible, and restore full working state when it receives a wxEVT_ACTIVATE or wxEVT_ACTIVATE_APP event.
Remarks
A top-level window (a dialog or frame) receives an activate event when it is being activated or deactivated. This is indicated visually by the title bar changing colour, and a subwindow gaining the keyboard focus.
An application is activated or deactivated when one of its frames becomes activated, or a frame becomes inactivated resulting in all application frames being inactive.
Please note that usually you should call event.Skip() in your handlers for these events as not doing so can result in strange effects.
See also
Event handling overview, wxApp::IsActive
Members
wxActivateEvent::wxActivateEvent
wxActivateEvent::GetActive
--- End quote ---
MortenMacFly:
--- Quote from: daniloz on February 03, 2011, 01:40:03 pm ---You mean, the plugin itself could (probably) register the raw wxEvent on the main window?
--- End quote ---
I don't think that's a good way to do. plugins should never interfere with the core in such way, obviously.
--- Quote from: daniloz on February 03, 2011, 01:40:03 pm ---Wouldn't it be better to go through a cbEvent, anyway?
--- End quote ---
So yes - that's the way to go. If you want to, to can try to design/implement a SDK event accordingly and provide a patch. It shouldn't be too hard. This would mean a change of the SDK API... just for the record.
Navigation
[0] Message Index
[#] Next page
Go to full version