Page 1 of 1

using wxFocusEvent and wxMouseEvent event macros

Posted: Fri Jan 02, 2009 10:51 am
by anna

i need to use MouseEvents and wxFocusEvent.

Now wxFocusEvent's event handlers are :


so it can be applied to a window right???
how do i apply it to a control?

If the event handler was like this:

EVT_SET_FOCUS(id,func) - it was easy.
now how do i do it?

n so is the case of wxxMouseEvents:

EVT_LEFT_UP(func) etc

so whenver i press the left button of mouse
the func is called right???

in my dialogs ive multiple controls.
combobox, radiobuttons and TextCtrl.

so whenever i click the mouse - the function is called?

how do i restrict it for a single control?

Posted: Fri Jan 02, 2009 2:02 pm
by Frank
You can use wxEvtHandler::Connect to connect an Event to whichever window you want.

Code: Select all

// myCtrl is the control, for wich you want the Focus-Event
// MyPanel is your Panel, wich shall handle the Event

myCtrl->Connect(wxEVT_SET_FOCUS,wxFocusEventHandler(MyPanel::OnSetFocus), NULL, this);
For more on wxEvtHandler::Connect() see ... lerconnect