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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Mouse...disable

Status
Not open for further replies.

fjagdis

Programmer
Aug 12, 2001
27
CA
I am working with VFP 6.0.
Question : can I disable the mouse ?
Problem : I have a routine which takes data from a table, creates a text file and then transfers the processed records to another table. I find that if the user clicks away at the mouse, the transferred records may lose the data in the first field! I believe that this has something to do with VFP reading ahead (i.e. before the current operation is completed). My solution is to disable the mouse and let the program prompt the user to continue at strategic point in the code (e.g. after the flush operation is done). How can I do this ? .......THANKS GUYS
 
fjagdis

You may consider using a temporary transparent "mask" over the whole form, that you would set to enable=.f., and remove it when the time comes. Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Here is an example using the API call I suggested that blocks the mouse and keyboard, the example is set for 5 seconds (copy the following in a program and run it.
Code:
PUBLIC oform1
oform1=NEWOBJECT("form1")
oform1.Show
RETURN
DEFINE CLASS form1 AS form
	DoCreate = .T.
	Caption = "Form1"
	Name = "Form1"
	ADD OBJECT timer1 AS timer WITH ;
		Top = 156, ;
		Left = 156, ;
		Height = 23, ;
		Width = 23, ;
		Interval = 0, ;
		Name = "Timer1"
	ADD OBJECT command1 AS commandbutton WITH ;
		Top = 96, ;
		Left = 144, ;
		Height = 27, ;
		Width = 84, ;
		Caption = "Start timer", ;
		Name = "Command1"
	ADD OBJECT text1 AS textbox WITH ;
		Height = 23, ;
		Left = 132, ;
		Top = 24, ;
		Width = 100, ;
		Name = "Text1"
	PROCEDURE Load
		DECLARE INTEGER BlockInput IN user32 INTEGER fBlockIt
	ENDPROC
        PROCEDURE timer1.Timer
		=blockinput(0)
	ENDPROC
	PROCEDURE command1.Click
		thisform.timer1.Interval = 5000
		=blockinput(1)
	ENDPROC
ENDDEFINE

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Thanks for the info ...Mike
The short program you provided runs well. I have studied it and found that you are using the blockinput function in user32.dll....nifty (I must learn more about using these WIN API functions). I will fiddle with code and see how I can incorporate it. Thanks again
 
Here is what I finally ended up with :
I used the following code

Object.MousePointer[ = nType]
in this manner

_screen.mousepointer=11 (hourglass pointer)
at the start of the routine
then,
_screen.mousepointer=1 (default pointer)
at the end of the routine.
The effect is to tell the user that something is in progress.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top