Set a form into a non-responsive state

  • Thread starter Thread starter Urs Vogel
  • Start date Start date
U

Urs Vogel

Hi

I would like to set a Windows.Form into a non responsive state, i.e. that it
does not respond to user input of any kind, similar to the state a forms
gets when another modal form is opened ontop with ShowDialog(). Form.Enabled
= false is not what I'm looking for, it changes the look of the form by
graying the window caption and the controls and is (very) slow, too.

I need this behaviour to prevent the user from entering data or clicking
onto controls while data is being processed on a server. In order to keep
the event thread responsive, the call to the server is launched from another
thread, so it can repaint and show intermediate results received from the
server. Once the final result is returned from the server, the form should
get back into a normal responsive state.

Any hints?

Thanks
Urs
 
I would like to set a Windows.Form into a non responsive state, i.e. that
it
does not respond to user input of any kind, similar to the state a forms
gets when another modal form is opened ontop with ShowDialog(). Form.Enabled
= false is not what I'm looking for, it changes the look of the form by
graying the window caption and the controls and is (very) slow, too. (...)

Hide the form (Visible=False), pop up the "Processing..." dialog with the
progress bar, animated hourglass or something. When the processing is done,
close the "Processing..." dialog and set the form back to the visible state.

sincerely,
--
Sebastian Zaklada
Skilled Software
http://www.skilledsoftware.com
************************************
SQL Source Control 2003 - for
SQL Server Source Safe integration
and custom databases documentation
 
Urs Vogel said:
Hi

I would like to set a Windows.Form into a non responsive state, i.e.
that it does not respond to user input of any kind, similar to the
state a forms gets when another modal form is opened ontop with
ShowDialog(). Form.Enabled = false is not what I'm looking for, it
changes the look of the form by graying the window caption and the
controls and is (very) slow, too.

I need this behaviour to prevent the user from entering data or
clicking onto controls while data is being processed on a server. In
order to keep the event thread responsive, the call to the server is
launched from another thread, so it can repaint and show intermediate
results received from the server. Once the final result is returned
from the server, the form should get back into a normal responsive
state.

Any hints?

You wrote
"I would like to set a Windows.Form into a non responsive state..."
and
"In order to keep the event thread responsive,..."

Contradiction? :-)

Either the UI is responsive or not. As you want to display something, it
must be responsive. I assume you don't want to create a 2nd UI thread, so I
see 2 ways:
a) disable all controls that should not be usable by the user during the
process
b) show another (modal) progress/result form, so you don't have to disable
the current form.


--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html
 
Lol - I could do with this tip too. At the moment, I'm manually "disabling"
those windows I don't want interaction with while the server thread is
running. It causes some flicker and is slow -

I guess some way of intercepting the message pump would be useful.
 
Back
Top