MouseMove Event

Questions about wxWidgets running on MS.NET, mono or Portable.NET ? Ask it here !
karim_jouini
In need of some credit
In need of some credit
Posts: 1
Joined: Wed Aug 22, 2007 10:16 am

MouseMove Event

Postby karim_jouini » Wed Aug 22, 2007 10:19 am

Hi,
I'm using wx.NET
And i can't get any MouseMove Event.
I tryed on a StaticBox and a StaticBitmap

What are the components that can catch mousemove events (and also have a picture on them) ?
Thanks

Karim

protocol
Moderator
Moderator
Posts: 680
Joined: Wed Jan 18, 2006 6:13 pm
Location: Dallas, TX
Contact:

Postby protocol » Tue Aug 28, 2007 6:58 pm

Not sure, but a work around is... You can get the mouse events that are raised by the frame, and then test the coords against the bounds of the target control.

best regards.
/* UIKit && wxWidgets 2.8 && Cocoa && .Net */
QuRegExmm
wxPCRE & ObjPCRE - Regex It!

upCASE
Site Admin
Site Admin
Posts: 3176
Joined: Mon Aug 30, 2004 6:55 am
Location: Germany, Cologne

Re: MouseMove Event

Postby upCASE » Wed Aug 29, 2007 7:09 am

Hi!
karim_jouini wrote:And i can't get any MouseMove Event.
I tryed on a StaticBox and a StaticBitmap

Did you derive your class from these and implemented an event table?

I remember that I had some problems with that as well.

karim_jouini wrote:What are the components that can catch mousemove events (and also have a picture on them) ?

Most, if not all, wxWindow derived classes should be able to handle mouse events. The only class with an image on it is wxStaticBitmap.

I'm not sure about wx.NET, but in C++ there is a simple solution for this. All you have to do is create the wxStaticBitmap as normal and then Connect() the event handler to it instead of creating an event table entry.
Like

Code: Select all

wxStaticBitmap* st1 = new wxStaticBitmap(this,-1,wxBitmap(img));
st1->Connect( wxID_ANY, wxEVT_MOTION , wxMouseEventHandler(MyFrame::OnMouse),NULL,this );

The event handler itself just works like it would when used in an event table. I'm able to display images and have motion events posted.
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


Return to “wx.NET”

Who is online

Users browsing this forum: No registered users and 2 guests