Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Click on desabled items ( how to prevent after item beco
Message
From
04/10/1999 01:33:56
Vladimir Zhuravlev
Institute of the Physics of Earth,Russia
Moscow Region, Russia
 
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00266970
Message ID:
00272194
Views:
25
>>>>My memory propably became weak, I know for sure I have known the answer on the problem, but have forget it.
>>>>Here is the problem
>>>>We have form and some button with code
>>>>We run some method on this button or other button
>>>>The proccess takes some time and we meke the button
>>>>being desabled on the time of the proccess
>>>>and will make it enabled after proccess was over
>>>>If to click desabled button , the code will work after the
>>>>button will become enabled
>>>>typeahead command fix problems with keyboard keeping stack.
>>>>What command, set or function will prevent keeping clicks of the mouse
>>>>So, roughly saying , I don't like the user will click on desabled item and the code of the click event under this button will work, when button will be enabled.
>>>>Thanks in advance
>>>>Vladimir Zhuravlev
>>>
>>>Assuming you are using the click event of the button, something like:
>>>
>>>This.Enabled = .F.
>>>Code segment here...
>>>....
>>>End of code segment...
>>>This.Enabled = .T.
>>>
>>>I'm not sure if I understand the question entirely, but it sounds like you also want to clear the keyboard buffer as well? If so, try:
>>>
>>>CLEAR TYPEAHEAD
>>>
>>>HTH, Bill
>>You are right, it is exactly, what I mean.
>>Yes I did it, but it did not prevent mouse click , only keyboards,
>>I also added inkey('MH') -much better,
>>but waht to do with the rest of buttons, which are enabled and ready to get
>>working, when other procces is going under disabled button.
>>It is important problem in VFP6+SP3 in multithread mode.
>
>The same concept would apply to the other buttons, just change the reference. As an example, say you have 3 buttons you want to disable name cmdButton1, cmdButton2, and cmdButton3. Lets also say the buttons are in a PageFrame on the form and the PageFrame is pgfMain and the Form name is frmMyForm. Final assumption is that cmdButton1 is the button the user clicks and you want to disable that one and the other 2 as well. The code would be:
>
>This.Enabled = .F.
>This.frmMyForm.pgfMain.cmdButton2.Enabled = .F.
>This.frmMyForm.pgfMain.cmdButton3.Enabled = .F.
>Code segment here...
>....
>End of code segment...
>This.Enabled = .T.
>This.frmMyForm.pgfMain.cmdButton2.Enabled = .T.
>This.frmMyForm.pgfMain.cmdButton3.Enabled = .T.
>
>You could also do:
>This.Enabled = .F.
>This.Parent.cmdButton2.Enabled = .F.
>This.Parent.cmdButton3.Enabled = .F.
>Code segment here...
>....
>End of code segment...
>This.Enabled = .T.
>This.Parent.cmdButton2.Enabled = .T.
>This.Parent.cmdButton3.Enabled = .T.
>
>yet another way:
>This.Enabled = .F.
>ThisForm.pgfMain.cmdButton2.Enabled = .F.
>ThisForm.pgfMain.cmdButton3.Enabled = .F.
>Code segment here...
>....
>End of code segment...
>This.Enabled = .T.
>ThisForm.pgfMain.cmdButton2.Enabled = .T.
>ThisForm.pgfMain.cmdButton3.Enabled = .T.
>
>Everyone has their own style and all of the above (and probably more I didn't think of) would work. The second one is my preference as it allows the buttons to be moved to any container (albeit moved to the form or to another page frame or even a container within a page frame) and the reference is still correct. HTH, write back if you need clarification.


Dear William , thanks a lot for answer. Don't be insulted please,
but I am not "VFP tearport" I work with it from 1995
I know how to make buttons being enabled and desaibled.
I talk about something else.
Let me say it one again.
Assume you do something client server in not synchronous mode.
You hanged some sql exec on button click , clicked it
and made button being desabled. Running sqlexec could take very big time
So you have time to do something else at VFP6 in multithread and asynchronous
mode of sqlexec Rest of buttons are ready to do something else.
But clicking frist disabled button should be prevented to avoid to run hard quary
again.
So to avoid it I do , what you have said pluss typeahead plus inkey('mh')
But it does not allow me to run next buttons in the time of long query runs.
MVP-2006-2011, PHD in Math and Physics ,
host of www.foxclub.ru,
VFP lector at Interface and Microinform companies
Head science researcher of VNIIA Rosatom.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform