Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Prevent double click from happening? 3

Status
Not open for further replies.

theThirdElement

Programmer
Jan 10, 2004
38
US
Hi,

I wonder if this is a common question.

For example, I have a checkbox, and by clicking on it many times quickly, it'll just interprete two clicks as a double click, so the checkbox would seem to "respond" slower than the checkboxes in other apps, e.g. in MS Word Options, where every click on a checkbox is just a click, no double clicks.

So is there a way to just make those two clicks as "two click events", not a double click event?

Many thanks,

Ed
 
Hi

If you are too much concerned, then in the doubleclick event add the code..
This.Click()
That should solve the problem. :)

____________________________________________
ramani - (Subramanian.G) :)
 
Ramani,

Thanks for your help. However by adding this.click() in the double click event, it'll simply interpret a double click as one click, rather than two clicks. Even if I put two lines of "this.click()" in there it still won't act the same, in terms of visual.

Not that big a problem, but just sometimes annoyed by what I see, as I expected a double tap (quick or slow) should see the tick display and then disappear (for the checkbox).

Thanks,

Ed
 
Hmm, finally figured out a way to do it, by adding the line:

this.Value = ABS(this.Value - 1)

to dblClick() (for the checkbox control)

This will fix the visual problem. Now it looks just like the checkboxes in the MS Word options :)

Ed
 
Hi Ed,

Couldn't you just add NODEFAULT to the doubleclick event?

Regards,

Mike
 
mspratt,
No it doesn't work right.

theThirdElement,
I'm giving you a start right after I post this for your elegant solution. Works like a charm, though it isn't readily apparent to me why this works like this...logically it shouldn't make the check box change states twice like that, but it does...and it is, just as you said, as responsive as MS Products checkboxes as seen in WORD - tools - options. Thanks for figuring it out.

Everyone else,
I've taken the liberty of creating a quick example of the behavior that Ed was talking about and how his solution resolves the problem...I think I shall be adding this to my checkbox subclasses as it really does make a difference in checkbox resposiveness. Just cut-n-paste the code below into a prg in VFP and run it to see the example of the difference in checkbox response to user double-click.

Code:
PUBLIC goForm

goForm = CREATEOBJECT("form1")
goForm.show()

**************************************************
*-- Form:         form1 (f:\temp\form2.scx)
*-- ParentClass:  form
*-- BaseClass:    form
*-- Time Stamp:   09/07/04 02:42:01 PM
*
DEFINE CLASS form1 AS form


	DoCreate = .T.
	Caption = "Double-click on the checkboxes"
	Name = "Form1"


	ADD OBJECT check1 AS checkbox WITH ;
		Top = 72, ;
		Left = 48, ;
		Height = 17, ;
		Width = 223, ;
		AutoSize = .T., ;
		Caption = "Using this.Value = ABS(this.Value - 1)", ;
		Name = "Check1"


	ADD OBJECT check2 AS checkbox WITH ;
		Top = 108, ;
		Left = 48, ;
		Height = 17, ;
		Width = 126, ;
		AutoSize = .T., ;
		Caption = "Using NODEFAULT", ;
		Name = "Check2"


	ADD OBJECT check3 AS checkbox WITH ;
		Top = 145, ;
		Left = 48, ;
		Height = 17, ;
		Width = 59, ;
		AutoSize = .T., ;
		Caption = "Normal", ;
		Name = "Check3"


	PROCEDURE check1.DblClick
		this.Value = ABS(this.Value - 1)
	ENDPROC


	PROCEDURE check2.DblClick
		NODEFAULT
	ENDPROC

ENDDEFINE
*
*-- EndDefine: form1
**************************************************

boyd.gif

craig1442@mchsi.com
"Whom computers would destroy, they must first drive mad." - Anon​
 
Hello,

Thank you for your stars, and thank Craig for such a nice example.

Although not much use (as no one would double click a checkbox on purpose), it's good to have the consistency in checkbox responses.

Ed
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top