differentiate double click from single click.

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
Javock
In need of some credit
In need of some credit
Posts: 9
Joined: Mon Oct 11, 2004 8:06 am
Location: Argentina
Contact:

differentiate double click from single click.

Post by Javock » Sun Jul 17, 2005 5:28 am

Hello,
I am writing an application that has a drawing tool, a polyline drawing tool to be precise. And I want to use left click to add segments to the poly and double left click to end the polyline.
I hooked an EVT_LEFT_UP and an EVT_LEFT_DCLICK to process both events.
The problem is that when I double click, the application processes both events, ie it adds a segment and closes the polyline. I want to close the line and nothing more.
I read that a double click event is : left_down, left_up, left_dclick, left_up, so this poses a *great* problem. How do I differentiante the events? Is it possible to put all the code in one method? how? what? help!!! :shock:
I am using wx2.4.2.

TIA,
Javock.

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

Post by upCASE » Mon Jul 18, 2005 7:03 am

Hi!
Apart from advising to skip to 2.6.1, have you tried checking ButtonDClick() for the wxMouseEvent?
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

Javock
In need of some credit
In need of some credit
Posts: 9
Joined: Mon Oct 11, 2004 8:06 am
Location: Argentina
Contact:

Post by Javock » Mon Jul 18, 2005 12:59 pm

upCASE wrote:Hi!
Apart from advising to skip to 2.6.1,
Does 2.6.1 solve this problem? mmmm interesting... I will see what can I do.
upCASE wrote:have you tried checking ButtonDClick() for the wxMouseEvent?
yeah, tried that... failed :(

geon
I live to help wx-kind
I live to help wx-kind
Posts: 189
Joined: Tue Sep 07, 2004 4:10 pm
Location: Sweden, Uppsala

Post by geon » Mon Jul 18, 2005 4:27 pm

Just ignore any click if the mouse hasn't moved since the last one.

Post Reply