using wxFocusEvent and wxMouseEvent event macros Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
anna
Earned a small fee
Earned a small fee
Posts: 23
Joined: Thu Nov 20, 2008 11:00 am

using wxFocusEvent and wxMouseEvent event macros

Post by anna » Fri Jan 02, 2009 10:51 am

hi....

i need to use MouseEvents and wxFocusEvent.

Now wxFocusEvent's event handlers are :

EVT_SET_FOCUS(func)
EVT_KILL_FOCUS(func)

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_DOWN(func)
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?

Frank
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 211
Joined: Sat Jan 01, 2005 6:19 pm

Post by Frank » Fri Jan 02, 2009 2:02 pm

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 http://docs.wxwidgets.org/stable/wx_wxe ... lerconnect

Post Reply