Event: Click on Label Topic is solved

If you are using wxDev-C++ for your wxWidgets design, please ask your questions here instead of in IDE Related.
Post Reply
Tobi
Earned a small fee
Earned a small fee
Posts: 10
Joined: Mon May 15, 2006 6:08 am

Event: Click on Label

Post by Tobi » Mon May 15, 2006 6:45 am

Hi, is it possible to catch a mouseclick on a Label (wxStaticText)? Or maybe you can skip the event to the underlying frame? (this happens when I choose enable=false, but I want the Label to be enabled!)
Can anybody help me?

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

Re: Event: Click on Label

Post by upCASE » Mon May 15, 2006 7:22 am

Tobi wrote:Hi, is it possible to catch a mouseclick on a Label (wxStaticText)? Or maybe you can skip the event to the underlying frame? (this happens when I choose enable=false, but I want the Label to be enabled!)
Can anybody help me?
There is no "standard" event handling for this, as static controls are normaly not clickable. However, you may be able to achieve this by using wxEvtHandler::Connect() to dynamically connect an event handler for that.
Like

Code: Select all

myStatic->Connect( wxEVT_LEFT_DOWN,wxMouseEventHandler(MyFrame::OnClickStatic),NULL,this );
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

Tobi
Earned a small fee
Earned a small fee
Posts: 10
Joined: Mon May 15, 2006 6:08 am

Post by Tobi » Wed May 17, 2006 2:00 am

Thank you very much for this quick, simple and absolute great solution!
Works fine.

Post Reply