Click to See Complete Forum and Search --> : Flushing keyboard and mouseclicks from VB, can you?


mrhicks
October 9th, 2001, 03:27 PM
Hello all,

At my present location, we have industrial PCs running on old 486 and P233 class machines which talk to another machine of the same class. There are several forms that are displayed depending upon how the user naviagate through the system. The problem that I am seeing or they are seeing in the field is that people will press a button and expect the form to transition quickly. Depending upon the form certain RPC are made and house keeping is done. Well, if the process takes more than a few seconds they perceive this as the button never registered they clicks so they click the button several times. Well, when the form finally finishes and loads the new form the additional clicks transfer to the next form that is displayed. If there is a button in the same locations as where the clicks were registered it will trigger a click for that button. This affect is not desired and I am trying to figure out a nice approach to solve this problem. I have tried using a boolean like


private Sub Btn1_Click()

if Not m_bFormNotActivatedYet then
' Perform my action now
End If

End Sub


private Sub Form_Activate()
' Last code to execute in Activate
m_bFormNotActivatedYet = false
End Sub

private Sub Form_Load()
' First Statement in Load
m_bFormNotActivatedYet = true
End Sub




This does appear to work. Next I used a timer to help solve this problem, but they don't like the side affect that is introduces. Which is they is a slight delay before they can press a button on the new form and the action takes place. So what I am looking for is some how to flush all keyboard and mouse click events from the que. Is there such a way to do this? I was always thinking of subclassing the form, but I was checking to see if there is another solution to this problem. Thanks

Mark

Cakkie
October 9th, 2001, 03:59 PM
Try setting the mousepointer of the form to vbHoursGlass, which will show an hourglass, and prevent the user from making clicks.
Another solution is to disable the form until it is fully loaded.
Yet another solution is to disable the button when it is pressed, and reenable it when it has finished executing, which also prevents the user from pressing the button twice.


Tom Cannaerts
slisse@planetinternet.be

Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook

mrhicks
October 9th, 2001, 04:25 PM
Hello,

I shall try the Mouse to a vbHourGlass. I haved tried diabling the Form as you suggested, but the side affect is that there is a slight delay ( around a half second ) before they are able to press the button again. They do not like this side affect as I mentioned. I can't disable the button since they don't like the look of the button being disabled for a split second. Yes, they are being harsh, but it is the requirements that I am trying to code by. Thanks for the help thus far.

Mark

John G Duffy
October 9th, 2001, 06:22 PM
set a switch in the button click event and ignore all future keypresses until the first is finished processing. Just before the first click event is fiished processing and before you reset the switch do a DOEvents to flush the extraneous clicks

John G

Schenn
October 9th, 2001, 10:00 PM
all im going to say is..where can i meet the people riding your butt like that so i can smack them. They must have an extremely limited computer knowledge to understand the speed at which their going causes it to take a couple seconds on such old comps. grrr, i hate mean people.

Schenn