Im fairly new to programming and wxWidgets, but I understand most of the concepts and do have some programming experience. My question is, I want to use a motion mouse event when the mouse rolls over a button to change some static text(wxStaticText). Any advice on how I would accomplish this? I assume an event table but what is the syntax for setting up something like that?
Thanks
Mouse Event question Topic is solved
Perhaps you could guide me a little more. So say I were to set up something similar to this:
This is what confuses me, theres no ID in the parameters so how do I direct the event?
Or am I supposed to implement another event table in my function that I go to from an EVT_BUTTON in the global scope event table.
Hope this clarifies my question a little. Thanks
Code: Select all
BEGIN_EVENT_TABLE(myClass, wxFrame)
EVT_ENTER_WINDOW(myClass::myFunction)
END_EVENT_TABLE()
Or am I supposed to implement another event table in my function that I go to from an EVT_BUTTON in the global scope event table.
Hope this clarifies my question a little. Thanks
-
- Super wx Problem Solver
- Posts: 323
- Joined: Sun Jun 08, 2008 11:59 am
- Location: Bordeaux, France
You need to create a new object that inherits from your button (for example, you want the mouse to display a text when the mouse is over the button).
So you create a myButton that is derived from wxButton.
Into this class, you put your event table like:
And into this function you can access the GetParent() element (that is your frame) in order to write into your static text your text, as GetParent()->myStaticText->SetLabel(...).
Now, in your frame, instead of creating a new wxButton, you create a "myButton" object.
Good luck.
So you create a myButton that is derived from wxButton.
Into this class, you put your event table like:
Code: Select all
BEGIN_EVENT_TABLE(myButton, wxButton)
EVT_ENTER_WINDOW(myButton::myFunctionButton)
END_EVENT_TABLE()
Now, in your frame, instead of creating a new wxButton, you create a "myButton" object.
Good luck.
OS: Ubuntu 11.10
Compiler: g++ 4.6.1 (Eclipse CDT Indigo)
wxWidgets: 2.9.3
Compiler: g++ 4.6.1 (Eclipse CDT Indigo)
wxWidgets: 2.9.3
Could you explain the Connect function just a little bit more? My google searches are turning up dry lol. Thanks
Edit:
I found this http://wiki.wxwidgets.org/Example_Of_Us ... For_Events
I understand everything except for the connect part, could anyone explain it? Thank you
Edit: Also for some reason this wont compile.
Edit:
I found this http://wiki.wxwidgets.org/Example_Of_Us ... For_Events
I understand everything except for the connect part, could anyone explain it? Thank you
Edit: Also for some reason this wont compile.
Take a look at this : http://wxwidgets.blogspot.com/2007/01/i ... nnect.html