forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


How to close a child dialog box?

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
flypaper
Contributor
Contributor


Joined: 19 Oct 2001
Posts: 104

PostPosted: Wed Feb 06, 2002 6:41 pm    Post subject: How to close a child dialog box? Reply with quote

I can't figure out how to get the damn thing to close. Grr Evil or Very Mad
Back to top
View user's profile Send private message
easy rider
Valued Newbie


Joined: 10 Sep 2001
Posts: 26
Location: Netherlands

PostPosted: Wed Feb 06, 2002 7:05 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Wed Feb 06, 2002 9:56 pm    Post subject: Reply with quote

I posted a simple example in the VDS 3 source code
section for creating and closing child windows. Smile

_________________
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
View user's profile Send private message Send e-mail
easy rider
Valued Newbie


Joined: 10 Sep 2001
Posts: 26
Location: Netherlands

PostPosted: Wed Feb 06, 2002 10:15 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Wed Feb 06, 2002 10:44 pm    Post subject: Reply with quote

Hey easy rider, Smile

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
View user's profile Send private message Send e-mail
Tommy
Admin Team


Joined: 16 Nov 2002
Posts: 746
Location: The Netherlands

PostPosted: Thu Feb 07, 2002 4:03 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
SnarlingSheep
Professional Member
Professional Member


Joined: 13 Mar 2001
Posts: 759
Location: Michigan

PostPosted: Thu Feb 07, 2002 4:43 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Thu Feb 07, 2002 9:52 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
vdsalchemist
Admin Team


Joined: 23 Oct 2001
Posts: 1448
Location: Florida, USA

PostPosted: Thu Feb 07, 2002 2:16 pm    Post subject: Reply with quote

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 Wink

_________________
Home of

Give VDS a new purpose!
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
easy rider
Valued Newbie


Joined: 10 Sep 2001
Posts: 26
Location: Netherlands

PostPosted: Thu Feb 07, 2002 6:27 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Thu Feb 07, 2002 7:40 pm    Post subject: Reply with quote

Thanks guys, Smile

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 Smile

_________________
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
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group