Re: XForms: FL_DBLCLICK never detected

Frank Stefani (EAD-Frank.Stefani@t-online.de)
Fri, 27 Jun 1997 09:42:12 +0200

To subscribers of the xforms list from EAD-Frank.Stefani@t-online.de (Frank Stefani) :

Steve Lamont wrote:

> I suspect the reason that you never get a double click event is that
> the Choice object is designed to actuate on the first click, deploying
> the Choice menu, so its timer probably never gets to get into the act.
>
> What you may need to do is interrogate the gettimeofday() timer, which
> returns seconds and microseconds since the Unix `millenium', in your
> preemptive handler:

Hi Steve,

in your following piece of code I changed some lines /* ! */. The
effect on choice objects looks strange to me:

* LEFT mouse button is never detected as a doubleclick. Instead
it is always intercepted and the choice list (menu) is opened.

* MIDDLE mouse button doubleclick runs into the message
"Doubleclick at ...", i.e. your timeval handler.

* RIGHT mouse button doubleclick is always detected as
"FL_DBLCLICK" with a preceeding "Doubleclick at ..."

Finally, if you change the default "int pre_empt = !FL_PREEMPT;"
to "int pre_empt = FL_PREEMPT;" you always get "Doubleclick at ..."
with every mouse button. You'll never see "FL_DBLCLICK" again.

>
> #include <sys/time.h>
>
> [...]
>
> int preempt_handler( FL_OBJECT *obj,
> int event,
> FL_Coord mx,
> FL_Coord my,
> int key,
> void *xev )
> {
> int pre_empt = !FL_PREEMPT;

/* ! */ if ( event == FL_DBLCLICK ) {
/* ! */ fprintf(stderr, "FL_DBLCLICK at '%s'\n",obj->label));
/* ! */ } else if ( event == FL_PUSH ) {

> static double last_t = 0.0;
> struct timeval tv;
> double current_t;
>
> gettimeofday( &tv, NULL );
>
> current_t = ( tv.tv_sec * 1000.0 ) + ( tv.tv_usec / 1000.0 );
>
> if ( (int)(current_t - last_t) < obj->click_timeout ) {
>

/* ! */ fprintf(stderr, "Doubleclick at '%s'\n",obj->label));

> pre_empt = FL_PREEMPT;
>
> }
> last_t = current_t;
>
> }
>
> return pre_empt;
>
> }

I think the clearest implementation would be to let all the
FL_DBLCLICK's through, so they can be handled as needed. The
current behaviour looks unclear or inconsequent to me ...

Thank's for your effort in this! You again deserve a very nice
weekend :-)

Transatlantic greetings,
Frank.

-- 
---------------------------------------------------------------
     _/_/_/_/     _/_/     _/_/_/    EAD-Systeme GmbH
    _/          _/  _/    _/    _/   Nachfeldstr. 4
   _/_/_/     _/    _/   _/     _/   D-82490 Farchant, Germany
  _/        _/_/_/_/_/  _/     _/    Phone: +49 8821 9623-0
 _/_/_/_/ _/        _/ _/_/_/_/      Fax: +49 8821 9623-20
---------------------------------------------------------------
Email: EAD-Frank.Stefani@t-online.de
---------------------------------------------------------------

_________________________________________________ To unsubscribe, send the message "unsubscribe" to xforms-request@bob.usuf2.usuhs.mil or see http://bob.usuf2.usuhs.mil/mailserv/xforms.html Xforms Home Page: http://bragg.phys.uwm.edu/xforms List Archive: http://bob.usuf2.usuhs.mil/mailserv/list-archives/