Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to make a dialog box disappear

0 views
Skip to first unread message

Xiangyang Liu ~{AuOrQt~}

unread,
Sep 24, 1995, 3:00:00 AM9/24/95
to

Thanks to all the people who replied to my posting about the window
sizes. Here is a new question:

I have a modal dialog box in my application, when the OK
button is clicked, some intensive calculations will be done which
takes a long time (longer than a minute). The dialog box won't
disappear from the screen until the calculation is finished (even
if I destroy/close it explicitly in my code). I guess it is because
the windows hasn't had a chance to update the screen. I am wondering
if there is a SIMPLE way (like a function call, perhaps) to make the
dialog box disappear from the screen immediately after the OK button
is clicked. The reason I want the dialog box to disappear is that it
looks really bad on the screen (part of window under it will show
after the OK button is clicked). Thanks for any help.


Xiangyang Liu

Tony T. Luu

unread,
Sep 25, 1995, 3:00:00 AM9/25/95
to
> I have a modal dialog box in my application, when the OK
>button is clicked, some intensive calculations will be done which
>takes a long time (longer than a minute). The dialog box won't
>disappear from the screen until the calculation is finished (even
>if I destroy/close it explicitly in my code). I guess it is because
>the windows hasn't had a chance to update the screen. I am wondering
>if there is a SIMPLE way (like a function call, perhaps) to make the
>dialog box disappear from the screen immediately after the OK button
>is clicked. The reason I want the dialog box to disappear is that it
>looks really bad on the screen (part of window under it will show
>after the OK button is clicked). Thanks for any help.
>
In the OnOK(), do the default OK processing before calling your
calculation routine

<your class>::OnOK()
{
CDialog::OnOK();

<...your calculation code...>
}

Hope this helps
Tony Luu

================================================
Tony T. Luu Tony...@SanDiegoCA.ATTGIS.COM
AT&T Global Information Solutions, SPD San Diego
17095 Via del Campo San Diego, CA 92127-1711
Tel.619-485-3383 Fax.619-485-3408

Jack Vinson

unread,
Sep 25, 1995, 3:00:00 AM9/25/95
to Xiangyang Liu ~{AuOrQt~}
>>>>> "XL" == Xiangyang Liu ~{AuOrQt~} <l...@valhalla.mda.uth.tmc.edu> writes:

XL> I have a modal dialog box in my application, when the OK
XL> button is clicked, some intensive calculations will be done which
XL> takes a long time (longer than a minute). The dialog box won't
XL> disappear from the screen until the calculation is finished (even
XL> if I destroy/close it explicitly in my code).

Maybe the calculations should be done after the Dialog procedure EndDialog
has been called? For example, instead of running the calculations from an
OnOK function, calculate once the DoModal() function returns to the
original caller.

--
Jonathan "Jack" Vinson jvi...@cheux.ecs.umass.edu
Sunderland, MA <http://www.cis.upenn.edu/~vinson/home.html>
"Churchill was a shopping bag" - Fatima Mansions

Chris Marriott

unread,
Sep 25, 1995, 3:00:00 AM9/25/95
to
In article <442m9v$a...@oac4.hsc.uth.tmc.edu>

l...@valhalla.mda.uth.tmc.edu "Xiangyang Liu ~{AuOrQt~}" writes:

>
>
>Thanks to all the people who replied to my posting about the window
>sizes. Here is a new question:
>

> I have a modal dialog box in my application, when the OK

>button is clicked, some intensive calculations will be done which

>takes a long time (longer than a minute). The dialog box won't

>disappear from the screen until the calculation is finished (even

>if I destroy/close it explicitly in my code). I guess it is because
>the windows hasn't had a chance to update the screen. I am wondering
>if there is a SIMPLE way (like a function call, perhaps) to make the
>dialog box disappear from the screen immediately after the OK button
>is clicked. The reason I want the dialog box to disappear is that it
>looks really bad on the screen (part of window under it will show
>after the OK button is clicked). Thanks for any help.

Call "UpdateWindow" after the dialog box disappears. This forces a screen
redraw.

Chris
--
--------------------------------------------------------------------------
Chris Marriott, Warrington, UK | Author of SkyMap v2 award-winning
ch...@chrism.demon.co.uk | shareware Windows planetarium.
For full info, see http://www.execpc.com/~skymap
Author member of Association of Shareware Professionals (ASP)
--------------------------------------------------------------------------


Rick Ekle

unread,
Sep 26, 1995, 3:00:00 AM9/26/95
to
In article <442m9v$a...@oac4.hsc.uth.tmc.edu>,

l...@valhalla.mda.uth.tmc.edu (Xiangyang Liu ~{AuOrQt~}) wrote:
>
>
>Thanks to all the people who replied to my posting about the window
>sizes. Here is a new question:
>
>I am wondering
>if there is a SIMPLE way (like a function call, perhaps) to make the
>dialog box disappear from the screen immediately after the OK button
>is clicked.

In MFC, call the ShowWindow function to hide it in your OK handler:

CMyDialog::OnOK()
{
ShowWindow( SW_HIDE );
// Do processing...
CDialog::OK();
}


Xiangyang Liu ~{AuOrQt~}

unread,
Sep 28, 1995, 3:00:00 AM9/28/95
to
In article <812054...@chrism.demon.co.uk>,

Chris Marriott <ch...@chrism.demon.co.uk> wrote:
>In article <442m9v$a...@oac4.hsc.uth.tmc.edu>
> l...@valhalla.mda.uth.tmc.edu "Xiangyang Liu ~{AuOrQt~}" writes:
>
>> I have a modal dialog box in my application, when the OK
>>button is clicked, some intensive calculations will be done which
>>takes a long time (longer than a minute). The dialog box won't
>>disappear from the screen until the calculation is finished (even
>>if I destroy/close it explicitly in my code). I guess it is because
>>the windows hasn't had a chance to update the screen. I am wondering

>>if there is a SIMPLE way (like a function call, perhaps) to make the
>>dialog box disappear from the screen immediately after the OK button
>>is clicked. The reason I want the dialog box to disappear is that it
>>looks really bad on the screen (part of window under it will show
>>after the OK button is clicked). Thanks for any help.
>
>Call "UpdateWindow" after the dialog box disappears. This forces a screen
>redraw.
>
>Chris
>--

Thanks to all the people who responded to my posting. I have tried
all the solutions (UpdateWindow(), ShowWindows(SW_HIDE), etc), but
the problem is still there. Any more help will be appreciated.

Xiangyang Liu


Oleg Toropov

unread,
Sep 29, 1995, 3:00:00 AM9/29/95
to
l...@odin.mda.uth.tmc.edu (Xiangyang Liu ~{AuOrQt~}) wrote:

[]In article <812054...@chrism.demon.co.uk>,


[]Chris Marriott <ch...@chrism.demon.co.uk> wrote:
[]>In article <442m9v$a...@oac4.hsc.uth.tmc.edu>
[]> l...@valhalla.mda.uth.tmc.edu "Xiangyang Liu ~{AuOrQt~}" writes:
[]>
[]>> I have a modal dialog box in my application, when the OK
[]>>button is clicked, some intensive calculations will be done which
[]>>takes a long time (longer than a minute). The dialog box won't

[skip]
[]Thanks to all the people who responded to my posting. I have tried


[]all the solutions (UpdateWindow(), ShowWindows(SW_HIDE), etc), but
[]the problem is still there. Any more help will be appreciated.

Just EndDialog, make your calculation , and..

DialogBox again ( if You need it ). DID You try this?!


0 new messages