How to make app responsive to windows but not to user during long process?

  • Thread starter Thread starter Samuel R. Neff
  • Start date Start date
S

Samuel R. Neff

I want to make my app repaint and show a wait cursor during a long
running process but not actually respond to user events. What's the
best way to implement this?

If I just put the process on another thread, the user can continue to
interact with the form. For my own code, I can have a flag in all
event handlers, but what about interaction within a control (i.e.,
expand/collapse tree nodes in treeview). If I change the Enabled
property, that affects the visual appearance of the controls, which I
don't want to do.

Any suggestions/examples?

Thanks,

Sam
 
Samual,

In an earlier situation about such a question as yours I once have given the
idea to set a panel (that holds all controls) on a form and too set that
panel to enable is false.

Is that maybe somehing you are looking for as well. The close and minimize
box is than still working so the user can minimize resize and move that
form.

I hope this helps

Cor
 
Thanks, but that still affects the visual display of the controls and
i want to avoid that (the wait cursor indicates that they can't click,
don't need disabled appearance as well).

Sam
 
Samuel,

In that case they are still there, however a little bit shadowed, I think
this is extra good with a wait cursor.

However just my idea.

Cor
 
Can't you display a type of "Wait" form then is modal and closes itself when
the waiting period has ended?
 
Samuel R. Neff said:
I want to make my app repaint and show a wait cursor during a long
running process but not actually respond to user events. What's the
best way to implement this?

If I just put the process on another thread, the user can continue to
interact with the form. For my own code, I can have a flag in all
event handlers, but what about interaction within a control (i.e.,
expand/collapse tree nodes in treeview). If I change the Enabled
property, that affects the visual appearance of the controls, which I
don't want to do.

Any suggestions/examples?

\\\
Private m_Busy As Boolean

Protected Property Busy() As Boolean
Get
Return m_Busy
End Get
Set(ByVal Value As Boolean)
m_Busy = Value
End Set
End Property
///

Inside the event handlers, check if the form is busy:

\\\
If Not Me.Busy Then
...
End If
///

Before starting the process, set 'Busy' to 'True' and set it back after the
process has been finished. For some controls, additional logic may be
added, for example, setting 'AutoCheck' to 'False' for checkboxes etc.
 
Dennis schreef:
Can't you display a type of "Wait" form then is modal and closes itself when
the waiting period has ended?

:
Can't you make all appropriate controls disabled? I think that makes it
clear to the user as well that no interaction is possible. You can leav
a cancel button enabled, if needed.
 
Samuel R. Neff said:
I want to make my app repaint and show a wait cursor during a long
running process but not actually respond to user events. What's the
best way to implement this?

If I just put the process on another thread, the user can continue to
interact with the form. For my own code, I can have a flag in all
event handlers, but what about interaction within a control (i.e.,
expand/collapse tree nodes in treeview). If I change the Enabled
property, that affects the visual appearance of the controls, which I
don't want to do.


What if they want to move or minimize the form?

You might take a snapshot of the form (including all controls) and
show that in a picturebox that sits on top of all the controls. That would
keep the image of the form and provide you a place to add your
progress bar. They can click on the picture box all they want, while
you don't have to respond.

When the process is over, simply hide the picturebox and all the controls
will be just the way you left them.

LFS
 
Yes, this sounds like a best approach. This way I can also show an
animation like windows explorer processes (i.e., copy file aniim).

Thanks,

Sam
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top