On Tue, Oct 23, 2012 at 9:08 AM, Staffan Tylen <staffan.ty...@gmail.com>wrote:


> I have two listview event handlers (via connectListViewEvent), one for
> CLICK and one for DBLCLK, and the event handler for CLICK always gets
> invoked even when I double-click. So one method is invoked for a single
> click and both methods are invoked if I double-click. In the CLICK method,
> how can I determine that I'm actually double-clicking?
>


By using some clever coding.

This is just the way Windows works, it is nothing to do with ooDialog.  The
double click event always starts with a single click event.

I'm really not sure if there would be a way in ooDialog to determine in the
CLICK event handler if it was *going* to be only a single click or a double
click.  (Well I take that back, I know there is no way to determine it in
the event handler.)

If you were programming in C / C++, you would probably start a timer that
is set to the current double click time on the system.  (This needs to be
looked up, because the double-click time is adjustable by a user.)

In C / C++ when the timer expires, if you haven't received the double click
event, you know it was a single click, you would do your single handling
code.  If the double click event has been  received, you would do your
double click handling code.

This is relatively non-trivial to code even in C / C++ and is the type of
thing that ooDialog is not easily capable of, is not really suitable for.
 The standard advice would be to re-design your user interface to only use
one or the other, not both.

To make a stab at implementing this in ooDialog, you could try using an
Alarm and some context variables to manage state.

In the CLICK handler, set a state variable to click received.  Then start
an alarm set to go off at the double click time, that invokes an unguarded
method in your dialog.

In your DOUBLE CLICK event handler, turn off the alarm and fool with the
state variables.  I say fool with the state variables, because I would have
to play with things a bit to come up with the proper state variables to
use, what and when to set, etc..  The statement above to set a state
variable to click received is probably incorrect.

Essentially you want to be able, when the alarm goes off, to know if you
should do the CLICK event handling or bail.

In theory this is doable and should work.  But, because of timing
variables, I'm not sure how robust it would be.  You would need to write up
some trial code and see.  You can't wait in the CLICK event handler, this
is likely to screw things up.

--
Mark Miesfeld
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
_______________________________________________
Oorexx-users mailing list
Oorexx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-users

Reply via email to