Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Continuous mousedown
Message
From
28/09/2006 10:44:13
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
01157829
Message ID:
01157846
Views:
24
>How can I detect that user keep mouse button down on a commandbutton ?
>
>For exemple, I'd like to make repetitive task, instead of clicking 1000x on a button, it'll be better than user keep mouse's button down on de commandbutton (the same way the user keep button down on a scrollbar in a grid)
>
>thanks

A quick example:
Public oForm

oForm = Newobject("repeatsample")

oForm.Show()

Define Class repeatsample As Form


	Height = 101
	Width = 275
	DoCreate = .T.
	AutoCenter = .T.
	Caption = "Form1"
	Name = "Form1"


	Add Object command1 As CommandButton With ;
		Top = 60, ;
		Left = 180, ;
		Height = 27, ;
		Width = 84, ;
		Caption = "Command1", ;
		Name = "Command1"


	Add Object label1 As Label With ;
		AutoSize = .T., ;
		Caption = "MOUSE UP", ;
		Height = 17, ;
		Left = 12, ;
		Top = 12, ;
		Width = 69, ;
		Name = "Label1"


	Add Object timer1 As Timer With ;
		Top = 36, ;
		Left = 216, ;
		Height = 23, ;
		Width = 23, ;
		Enabled = .F., ;
		Interval = 1000, ;
		Name = "Timer1"


	Procedure command1.MouseUp
	Lparameters nButton, nShift, nXCoord, nYCoord
	Thisform.label1.Caption = "MOUSE UP"
	Thisform.timer1.Enabled = .F.
	Endproc


	Procedure command1.MouseDown
	Lparameters nButton, nShift, nXCoord, nYCoord
	Thisform.label1.Caption = "MOUSE DOWN"
	*!* Do you thing here, after 1 second repetitive thing starts
	Thisform.timer1.Reset()
	Thisform.timer1.Enabled = .T.
	Endproc


	Procedure timer1.Timer
	Thisform.label1.Caption = "MOUSE DOWN " + Time()
	*!* Do your repetitive thing here
	Endproc


Enddefine
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform