S
Steve Sargent
Hi:
I'm having problems restoring the focus to my main window after
calling a couple of dialog boxes. Sometimes the focus is restored,
other times not.
In my code, when setting up an account, the user clicks the button and
the event handler for the button pops up. The event handler then
calls thread to handle the setting up of accounts. This thread then
calls 3 dialog boxes to gather information. Intermixed ars 2 message
boxes with simple ok buttons.
At the end of the thread (the one created from within the event
handler), in the finally block, I have code to restore the focus. It
checks as to whether invocation is required, and if so, invoke a
function to set focus and refresh this form. (if not needed, I call
this function directly).
The code I'm using to reset the display is
this.Focus();
this.Refresh();
Am I missing something? I've checked to make sure that none of my
dialog boxes have TopMost set to true. Are there other functions I
need to be working with to get my original window to resurface after
the account setup takes place?
This seems to work for the most part. However, sometimes it doesn't
do anything at all. I've traced the code and stepped through the
callsf as they call these to calls, and sometimes they work, sometimes
they don't.
Any help with this is greatly appreciated.
Steve
I'm having problems restoring the focus to my main window after
calling a couple of dialog boxes. Sometimes the focus is restored,
other times not.
In my code, when setting up an account, the user clicks the button and
the event handler for the button pops up. The event handler then
calls thread to handle the setting up of accounts. This thread then
calls 3 dialog boxes to gather information. Intermixed ars 2 message
boxes with simple ok buttons.
At the end of the thread (the one created from within the event
handler), in the finally block, I have code to restore the focus. It
checks as to whether invocation is required, and if so, invoke a
function to set focus and refresh this form. (if not needed, I call
this function directly).
The code I'm using to reset the display is
this.Focus();
this.Refresh();
Am I missing something? I've checked to make sure that none of my
dialog boxes have TopMost set to true. Are there other functions I
need to be working with to get my original window to resurface after
the account setup takes place?
This seems to work for the most part. However, sometimes it doesn't
do anything at all. I've traced the code and stepped through the
callsf as they call these to calls, and sometimes they work, sometimes
they don't.
Any help with this is greatly appreciated.
Steve