Matti wrote:
> When I want to use a DblClick event on some controls that don't have the 
> "Activate" event (eg PictureBox), I get difficulties:
>
> The MouseDown event is (of course) raised before the DblClick event.
> So, before I can react to DblClick, I always land in MouseDown. Here I can 
> tell if the mouse was pressed left or right and
> everything, but I can't see if it is just the first click of a DblClick.
>
> I don't see a possibility to respond to a single-click on the control in one 
> Sub, and to a double-click in another, because
> there are always two events when there is a double-click.
>
> Any ideas?
> Thanks, Matti
You could try to knit your own doubleclick. All it needs is a timer.

Here is a pseudo code rough sketch:


Event routine myControl_MouseDown:
If myTimer is running
    then
       stop myTimer
       #do your Double Click stuff here
    else
       start myTimer
    end
end # myControl_MouseDown


Event routine myTimer_Timer:
stop myTimer
#do your single click stuff here
end # myTimer_Timer


You can then play with myTimer.Delay. Setting it to 1ms effectively
disables double click. I think 300..400ms is a good number. Maybe the
desktop of choice has a preference scheme where the user can set the delay.
MyTimer.Enabled is initially false.

Regards
Werner



------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to