Mouse events handling

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
User avatar
kolo
Earned some good credits
Earned some good credits
Posts: 120
Joined: Tue Jun 21, 2005 1:19 pm
Location: Russia, Cheboksary
Contact:

Mouse events handling

Post by kolo »

I have some problem. I write MDI doc/view architechture support application. I have a class MainFrame that create main window, init menu and etc. and I want to handle mouse events in this class, but it doesn`t work. Help, please.
P.S. i`m sorry for my english ))
upCASE
Moderator
Moderator
Posts: 3176
Joined: Mon Aug 30, 2004 6:55 am
Location: Germany, Cologne

Re: Mouse events handling

Post by upCASE »

kolo wrote:I have some problem. I write MDI doc/view architechture support application. I have a class MainFrame that create main window, init menu and etc. and I want to handle mouse events in this class, but it doesn`t work. Help, please.
Use PushEventHandler() or wxEvtHandler::Connect().
kolo wrote:P.S. i`m sorry for my english ))
It's ok, we've seen worse things :D
OS: OpenSuSE, Ubuntu, Win XP Pro
wx: svn
Compiler: gcc 4.5.1, VC 2008, eVC 4

"If it was hard to write it should be hard to read..." - the unknown coder
"Try not! Do. Or do not. There is no try." - Yoda
User avatar
kolo
Earned some good credits
Earned some good credits
Posts: 120
Joined: Tue Jun 21, 2005 1:19 pm
Location: Russia, Cheboksary
Contact:

Post by kolo »

I write

Code: Select all

Connect(0, wxEVT_MOTION, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) OnMouseMove);
but it doesn`t work
What else may be incorrect?
Additional information:
MainFrame child of wxDocMDIParentFrame
GianT
Earned some good credits
Earned some good credits
Posts: 124
Joined: Wed Mar 16, 2005 5:44 pm
Location: Guadeloupe, French West Indies
Contact:

Post by GianT »

Have you tried with other flags that wxEVT_MOTION? If your mouse has 3 buttons, you can try with the EVT_MOUSEWHEEL flag, then when your program runs, just play with the mousewheel and see what happens.
Or maybe should you set your events in an event table? Here is an example:

Code: Select all

BEGIN_EVENT_TABLE(newProgramFrame,wxFrame)

    EVT_MOTION(newProgramFrame::OnMouseEventFunction)

END_EVENT_TABLE()
User avatar
kolo
Earned some good credits
Earned some good credits
Posts: 120
Joined: Tue Jun 21, 2005 1:19 pm
Location: Russia, Cheboksary
Contact:

resolved [Mouse event hadling]

Post by kolo »

Thank all for helping. One man said me that parent window can only command events process, not mouse events. May be he is right.
Post Reply