Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Boudewijn Lutgerink
  Where is Boudewijn Lutgerink?
 Hoonaardstraat, Driel
 Netherlands
 Boudewijn Lutgerink
 To: Bill von Valtier
  
 Rochester
 
 Bill von Valtier
 Tags
Subject: RE: DblClick fires Click
Thread ID: 22341 Message ID: 22356 # Views: 0 # Ratings: 0
Version: Visual FoxPro 6 Category: General VFP Topics
Date: Wednesday, April 16, 2003 1:16:23 PM         
   


> Hello friends,
>
> If I put code into both the Click and the DblClick events of a control, when DblClick is done, the Click fires first (obviously because it's the first of two clicks, and it gets there first) preempting the DblClick. Commenting-out the Click event code allows the DblClick to fire. Changing the _DoubleClick system variable seems to make no difference.
>
> Is this by design (? maybe we're not supposed to use both in any one control?) or am I missing something?
>
> TIA
>
> BillvV
> Rochester, Michigan
See this as basic windowsbehavior.
If you click on a control you select it and nothing happens. Dblclick on it and some action occurs.
Therefore your finding that click and dblclick should not have event code in one control is right.
This is one area where VFP8 shines with the bindevent() function in combination with unbindevents().



Assume this:
A form with a textbox and checkbox.

When you click on the textbox you want something to happen.
When you select a checkbox, you want the dblclick to react that way.
In the init of the textbox place this code:
BINDEVENT( this, "click", thisform, "clickme")


In the click event from the checkbox place this code.
IF this.Value
	this.Caption = "DblClick"
	UNBINDEVENTS( thisform.text1,"click",thisform,"clickme")
	BINDEVENT( thisform.text1,"dblclick",thisform,"clickme")
ELSE
	this.Caption = "Click"
	UNBINDEVENT( thisform.text1,"dblclick",thisform,"clickme")
	BINDEVENT( thisform.text1,"click",thisform,"clickme")
ENDIF


The form has one method "Clickme"
The high tech code there is:
wait window nowait "Aw, you hit me hard... that hurts!!!"


When checked the click event is unbind and the dblclick is bound to that method.
When unchecked the click is bound to the method and the dblclick is unbound.

for those who want to see that code click here to download the file.

Boudewijn LutgeĀ®ink
Boudewijn.Lutgerink@foxite.com
Experience is the knowledge you get immediately AFTER you actually needed it...

COMPLETE THREAD

DblClick fires Click Posted by Bill von Valtier @ 4/16/2003 6:30:12 AM
RE: DblClick fires Click Posted by Boudewijn Lutgerink @ 4/16/2003 1:16:23 PM
RE: DblClick fires Click Posted by Bill von Valtier @ 4/17/2003 6:32:04 PM
RE: DblClick fires Click Posted by Dale Dedoroy @ 4/20/2003 12:11:58 PM
Thanks Posted by Bill von Valtier @ 4/20/2003 1:06:45 PM