www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/05/19/00:58:43

Message-ID: <33807861.775C@post.comstar.ru>
Date: Mon, 19 May 1997 08:57:21 -0700
From: Dim Zegebart <zager AT post DOT comstar DOT ru>
Reply-To: zager AT post DOT comstar DOT ru
Organization: zager AT post DOT comstar DOT ru
MIME-Version: 1.0
To: DJGPP Mail List <djgpp AT delorie DOT com>
Subject: Re: Double Click
References: <01bc61a3$40e5d960$46c074cf AT ian>

Ian Pitt wrote:
> 
> I am writing a mouse routine using DJGPP but I am having trouble
> implementing detection of a Double Click.  Does anybody have any
> suggestions?

If you have timer handler with high resolution (like Allegro's one)
declare global counter tick_counter and do tick_counter++ 'each'
clock cicle, also declare variable last_left_click and set it
to tick_counter value each left mouse click. Befor this assigment
check last_left_click-tick_counter<=dbl_click_time :
long tick_counter
...
timer_handler ()
 { tick_counter++;
   ...
 }
...
mouse_handler ()
 { static last_left_click=tick_counter;
   if ((last_left_click-tick_conter)<=dbl_click_time)
    { //dbl click
      last_left_click=tick_counter;
      return();
    }

   last_left_click=tick_counter;
 }

-- 
Regards,
Dim Zegebart, 
Moscow Russia.
Ghostly basement : http://www.geocities.com/siliconvalley/pines/7817

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019