How can I diasble user interaction until background processing complete?

bobhooper

New member
Joined
Feb 14, 2005
Messages
3
Programming Experience
10+
I am writing a screen-scraping app using some third-party VT/Telnet classes, which aims to drive a unix green-screen app as if the user were typing directly into it.

I react to gotFocus events on my windows form controls, which triggers data to be sent to unix, possibly in several bursts. I react to the multiple endReceive events that get fired when Unix talks back.

I need to keep the unix app and windows form in step, and this would seem to be easier to acheive if i can disable user interaction on the windows form until my app assumes that unix has got where it was directed to go i.e. no more endReceives are forthcoming and I can identify where the cursor is on screen.

What approaches would achieve this aim?

I could set enable=false on the form, which results in the usual grey, flat look. However, assuming the two sides of my app get in step relatively quickly this would result in the screen 'flickering' unacceptably between colourful and grey on a very frequent basis.
 
Mhh..
you could use some boolean such as running..

Then add to every sub "If Not running Then Exit Sub"..

If you're waiting for your unix app, set running = false, else set it to true.

But that's definetly not beautiful, but the only way i know you may do it...

Cya CowZ
 
the thing is i need to stop the user actually moving to another windows control, otherwise it'll fire another gotFocus event, which my app will attempt to handle, possibly while it's still talking to unix to get it in step. it seems to be far easier to stop the gotFocus ever being triggered while background processing is still happening.
 
Why don't you use my code in GotFocus()?

That would help, or? *hope.so* ;)

Or do you really want to stop _any_ interaction with the user (e.g. change to internet explorer)? that would become difficult, imho..

Cya CowZ
 
i agree that i could 'throw away' the gotFocus but having to handle it in the first place means that the user has moved within the windows form and is now not in step with the unix app, even if unix has ended-up where the user originally intended.

I have looked at doing something similar to your suggestion in the validation event handler on controls ... if the 'busy' flag is set I cancel the event, so the user stays on the same windows control. This approach would work but gives me more work when i also want to use the validation handler to do 'real' validation of the data in the control.

If there was a way of mimicking enabled=false on the form without it looking so ugly, that would be great.
 
or even earier lock the entire form altogether so no events can fire and nothing can be changed...

almost every object (every visual object does) has an Enabled property

formname (or Me).Enabled = False
when processing is done
formname (or Me).Enabled = True
user continues using the app as normal
 
he'd given that answer before..

the problem is, that the whole form is getting gray and that looks bad ;)

cya cowz
 
Back
Top