| View previous topic :: View next topic |
| Author |
Message |
flypaper Contributor


Joined: 19 Oct 2001 Posts: 104
|
Posted: Wed Feb 06, 2002 6:41 pm Post subject: How to close a child dialog box? |
|
|
I can't figure out how to get the damn thing to close. Grr  |
|
| Back to top |
|
 |
easy rider Valued Newbie

Joined: 10 Sep 2001 Posts: 26 Location: Netherlands
|
Posted: Wed Feb 06, 2002 7:05 pm Post subject: |
|
|
here's a sample from a open about dialog. to go back to your original program you have to select 0 The about dialog is select 1
| Code: |
:Aboutmenu
dialog select,1
dialog show
wait event
%Z = @event()
if %Z
goto %Z
end
:bt1button
dialog hide
dialog select,0
goto evloop |
see you rene |
|
| Back to top |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Wed Feb 06, 2002 9:56 pm Post subject: |
|
|
I posted a simple example in the VDS 3 source code
section for creating and closing child windows.  _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
 |
|
| Back to top |
|
 |
easy rider Valued Newbie

Joined: 10 Sep 2001 Posts: 26 Location: Netherlands
|
Posted: Wed Feb 06, 2002 10:15 pm Post subject: |
|
|
Or try this
| Code: |
TITLE child dialog
DIALOG CREATE,Main,-1,0,100,100
DIALOG ADD,BUTTON,ok,10,10,50,20,OK
Dialog add,button,about,40,10,50,20,About
Dialog create,about,-1,0,200,100
dialog add,button,close,10,10,50,20,Close
dialog select,0
DIALOG SHOW
:EVLOOP
wait event
goto @event()
:Aboutbutton
dialog select,1
dialog show
wait event
%I = @event()
if @equal(%I,closebutton)
goto %I
end
:closebutton
dialog hide
dialog select,0
goto evloop
:Okbutton
exit
end
|
see ya Rene |
|
| Back to top |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Wed Feb 06, 2002 10:44 pm Post subject: |
|
|
Hey easy rider,
Is there a reason you're hiding the window
instead of creating/closing it each time?
Also, there's no CLOSE label in your example... _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
 |
|
| Back to top |
|
 |
Tommy Admin Team
Joined: 16 Nov 2002 Posts: 746 Location: The Netherlands
|
Posted: Thu Feb 07, 2002 4:03 am Post subject: |
|
|
I would expect that hiding and showing is much easier than creating and closing...
Last edited by Tommy on Thu Feb 07, 2002 6:03 am; edited 1 time in total |
|
| Back to top |
|
 |
SnarlingSheep Professional Member


Joined: 13 Mar 2001 Posts: 759 Location: Michigan
|
Posted: Thu Feb 07, 2002 4:43 am Post subject: |
|
|
I think that using Close on child windows is easier than Hide, as long as you use %%whatever = @event() after using Dialog Close to catch the event and not close the main Dialog.. _________________ -Sheep
My pockets hurt... |
|
| Back to top |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Thu Feb 07, 2002 9:52 am Post subject: |
|
|
The main reason I asked was because the post was about
closing a child window, not hiding it...
I would assume create/close takes less resources since
the window is not always staying in the system whether
hidden or shown. And I agree with Sheep that it's easier.
An EVLOOP and CLOSE combo such as the one in the
child example I posted will close multiple child dialogs,
and still process other events normally. _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
 |
|
| Back to top |
|
 |
vdsalchemist Admin Team

Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Thu Feb 07, 2002 2:16 pm Post subject: |
|
|
Hi All,
Actually Mac is right. It does take up less resources to create/close a window than to maintain it in memory with show/hide. Not to mention that if you are using a child window to refresh your main window the create/close method is faster because Windows does not fly the window from the taskbar to the location that you are creating it. Windows just builds the child window at the location you tell it to. Just some thoughts to think about is all  _________________ Home of
Give VDS a new purpose!
 |
|
| Back to top |
|
 |
easy rider Valued Newbie

Joined: 10 Sep 2001 Posts: 26 Location: Netherlands
|
Posted: Thu Feb 07, 2002 6:27 pm Post subject: |
|
|
Hi Mac
you absolutly right. I didn't now about the @event(d).
Also there isn't a reason for hiding a dialog ( i didn't read the message very well).
About no close, simple put :close above the :okbutton but this isn't working very well because if you close the child window it closes the whole dialog, so i like you're script very much.
See you Rene |
|
| Back to top |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Thu Feb 07, 2002 7:40 pm Post subject: |
|
|
Thanks guys,
I managed to optimize the example slightly - eliminated
the "else" line in the CLOSE label, and changed the vars
where %e is the @event() and %d is the dialog number.
Hopefully made it clearer for new users...
Cheers, Mac  _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
 |
|
| Back to top |
|
 |
|