RE: Hide() not working correctly by PaulR
PaulR
Tue Oct 28 08:58:38 CST 2003
Hi,
Thanks for the reply.
I had previously tried inserting a call to
Application.DoEvents() before the call to hide, but this
had another adverse effect...
Our application uses the keyboard to navigate. If the
uses quickly navigates from FormA to FormB and back to
FormA then both of the forms end up being hidden!
Do you have any other suggestions!?
>-----Original Message-----
>Hi Paul,
>As you said, formB.Show need do a lot of initialization
which will take a
>second or two, in my mind, this might block the message
loop, so the
>WM_ACTIVATE/WM_DEACTIVATE message will be blocked until
the current event
>handler return.
>So actually Hide is executed before processing
WM_ACTIVATE message, while
>the result of activating a hidden window is not
defined. you may call
>Application.DoEvents before calling formA.Hide this will
give chance to
>Framework to handle WM_ACTIVATE before calling Hide. Or
try inserting some
>DoEvents call in your On_Load event handler of formB,
this will make your
>application more interactively.
>
>Does this solve your problem?
>Be free to post on this group, if you still have problem
on this issue.
>Thanks!
>
>
>Best regards,
>
>Ying-Shen Yu [MSFT]
>Microsoft Online Partner Support
>Get Secure! - www.microsoft.com/security
>
>This posting is provided "AS IS" with no warranties and
confers no rights.
>You should not reply this mail directly, "Online" should
be removed before
>sending, Thanks!
>
>--------------------
>| Content-Class: urn:content-classes:message
>| From: "Paul R" <robinsonpr@aol.com>
>| Sender: "Paul R" <robinsonpr@aol.com>
>| Subject: Hide() not working correctly
>| Date: Mon, 27 Oct 2003 03:43:02 -0800
>| Lines: 31
>| Message-ID: <03cc01c39c7f$7a7a9760$a001280a@phx.gbl>
>| MIME-Version: 1.0
>| Content-Type: text/plain;
>| charset="iso-8859-1"
>| Content-Transfer-Encoding: 7bit
>| X-Newsreader: Microsoft CDO for Windows 2000
>| X-MimeOLE: Produced By Microsoft MimeOLE
V5.50.4910.0300
>| Thread-Index: AcOcf3p4Ojh9L9W0TaOqqGcEkHxb5Q==
>| Newsgroups:
microsoft.public.dotnet.framework.windowsforms
>| Path: cpmsftngxa06.phx.gbl
>| Xref: cpmsftngxa06.phx.gbl
>microsoft.public.dotnet.framework.windowsforms:55283
>| NNTP-Posting-Host: TK2MSFTNGXA08 10.40.1.160
>| X-Tomcat-NG:
microsoft.public.dotnet.framework.windowsforms
>|
>| Hi,
>|
>| My application should only ever display one form at a
>| time. To achieve this I navigate between forms using
the
>| following logic:
>|
>| From formA to formB -
>|
>| formB.Show()
>| formA.Hide()
>|
>| This is fine and works OK except in the following case:
>|
>| If the form to be displayed (formB) takes a few
seconds
>| to load, and in that time the user clicks on the
current
>| form (formA) IN THE TASKBAR, the system displays formB
>| but does not hide formA. Both of the forms are
displayed
>| in the taskbar, and both can be selected by clicking
or
>| Alt+Tabbing.
>|
>| I have put some debug in, and the form being hidden
does
>| get the message, and it even thinks it has been hidden
>| (if your query the Visible property it is set to
False,
>| even though it clearly IS visible).
>|
>| This is becoming a real pain and I have not yet found
a
>| suitab;e workaround. Can anyone help?
>|
>| Thanks for any help.
>|
>|
>|
>
>.
>