Re: XForms: FL_DBLCLICK never detected

Steve Lamont (
Thu, 26 Jun 97 06:52:21 PDT

To subscribers of the xforms list from (Steve Lamont) :

> A double click gives the same output, always FL_PUSH, never
> FL_DBLCLICK. So I thought it has to do with the dblclick_timeout
> and I inserted some
> fl_set_object_dblclick(fd_debitor_frm->d_grp, val);
> ^^^
> calls in my code. I found no information about the 2nd parameter.
> It should be an integer, but the range is nowhere explained. ...

It is in milliseconds. Thus, setting a val of 10 would set a double
click threshold of 0.01 seconds. BTW, this is just a macro which sets
the object structure click_timeout member.

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:

#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_PUSH ) {

static double last_t = 0.0;
struct timeval tv;
double current_t;

gettimeofday( &tv, NULL );

* Convert to milliseconds. I'd do this in double since
* long integers may overflow. This will give you some
* more bits with which to play.

current_t = ( tv.tv_sec * 1000.0 ) + ( tv.tv_usec / 1000.0 );

* Is it less than the currently assigned click timeout?

if ( ( int ) ( current_t - last_t ) < obj->click_timeout ) {

pre_empt = FL_PREEMPT;

last_t = current_t;


return pre_empt;


To unsubscribe, send the message "unsubscribe" to or see
Xforms Home Page:
List Archive: