How to turn off control focus highlights while the wait cursor is shown?
My application reads a bunch of data from a database, which takes several seconds. During that time, I would like to display an hourglass cursor and not allow the user to interact with the program.
Initially, I did this all in a single thread, but that caused some display update issues (the display didn't update...), so I have pulled the database stuff into a second thread. All of this works fine.
When I start the database work, I call Application.UseWaitCursor=True (in the parent thread) to get the hourglass. This, however, leaves the menu bar, the tool bar, and the various form buttons active so that they highlight (and can be selected) when the user moves the hourglass over the object.
What do I need to do to disable the various objects while the hourglass is active?
Thanks,
DaveL
[826 byte] By [
DaveL5] at [2007-12-16]
Using this.enabled=false on the main form has the side-effect of turning everything grey -- disabling all of the controls. While this does prevent the user from selecting anything, it also changes the appearance and, in some cases, actually pops another window to the top of the view stack.
What I want to do is exactly what MS applications do when the hourglass is shown: the window remains unchanged (nothing greyed out), the window stack doesn't change, the mouse cursor continues to follow the mouse movements, display updates continue to happen, but selection and highlight of menu/toolbar/buttons does not happen. This is very similar to what would happen if the work was being done in a single thread, except the single thread case prevents display updates.
Somehow I need to turn off the various highlights and disable selection. I'll probably need to add code to all of the click/doubleclick/... events to cancel them while the hourglass is active, but there has to be a better way!
DaveL