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 


Simple Child Window

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Visual DialogScript 3 Source Code
View previous topic :: View next topic  
Author Message
Mac
Professional Member
Professional Member


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

PostPosted: Wed Feb 06, 2002 9:52 pm    Post subject: Simple Child Window Reply with quote

Shows how to create and close child dialogs.

NOTE: Main dialog (first one created) is always DIALOG 0.
Any others always stay in numerical order, so if you have
3 child dialogs (1, 2, and 3) and close DIALOG 1, number 2
becomes number 1, and number 3 becomes number 2, etc. Wink
__________________________________________________________________________________________________________________________
Code:

TITLE By Mac
DIALOG CREATE,Main,-1,0,200,100
  DIALOG ADD,BUTTON,Child,5,5,150,20,"Open Child Window"
DIALOG SHOW

:EVLOOP
  WAIT EVENT
  rem -- %e is event, %d is dialog number that issued it (0,1,2,etc.) --
  PARSE "%e;%d", @event(d)
  DIALOG SELECT, %d
  goto %e

:ChildBUTTON
  rem -- Allow only one --
  if @not(@winexists("Child"))
     DIALOG CREATE,"Child",-1,0,100,50,NOMIN
       DIALOG ADD,BUTTON,Test,5,5,50,20
     DIALOG SHOW
  end
  goto EVLOOP

:TestBUTTON
  INFO Dialog = %d@cr()@cr()Event = %e@tab()
  goto EVLOOP

:CLOSE
  if @greater(%d, 0)
     DIALOG CLOSE
     rem -- Kill extra CLOSE event -
     %e = @event()
     goto EVLOOP
  end
  EXIT

EDIT1- Optimized code slightly, changed "@event()" var to %e
and "dialog" var to %d (hopefully it's clearer for new users).
EDIT2 - Changed code to select dialog in EVLOOP (thanks cnodnarb).

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
Mac
Professional Member
Professional Member


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

PostPosted: Wed Dec 11, 2002 11:30 pm    Post subject: Reply with quote

Selecting the dialog from the EVLOOP requires special
handling of TIMER events. TIMER events will parse the
last dialog selected into %d, and if it's closed ya get an
error.

Use something like this to catch TIMER events:
__________________________________________________________________________________________________________________________
Code:

:TIMER
  rem -- Timer code goes here --
:EVLOOP
  WAIT EVENT, 1
  rem -- %e is event, %d is dialog number that issued it (0,1,2,etc.) --
  PARSE "%e;%d", @event(d)
  if @equal(%e, "TIMER")
     goto TIMER
  end
  DIALOG SELECT, %d
  goto %e

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
filip
Valued Contributor
Valued Contributor


Joined: 07 Aug 2004
Posts: 340

PostPosted: Thu Jan 13, 2005 9:58 am    Post subject: Reply with quote

TITLE By Mac
DIALOG CREATE,Main,-1,0,200,100
DIALOG ADD,BUTTON,Child,5,5,150,20,"Open Child Window"
dialog add,text,text1,30,0
DIALOG SHOW

:EVLOOP
WAIT EVENT, 1
rem -- %e is event, %d is dialog number that issued it (0,1,2,etc.) --
PARSE "%e;%d", @event(d)
if @equal(%e, "TIMER")
goto TIMER
end
DIALOG SELECT, %d
goto %e

:ChildBUTTON
rem -- Allow only one --
if @not(@winexists("Child"))
DIALOG CREATE,"Child",-1,0,100,50,NOMIN
DIALOG ADD,BUTTON,Test,5,5,50,20
DIALOG SHOW
end
goto EVLOOP

:TestBUTTON
INFO Dialog = %d@cr()@cr()Event = %e@tab()
goto EVLOOP

:CLOSE
if @greater(%d, 0)
DIALOG CLOSE
rem -- Kill extra CLOSE event -
%e = @event()
goto EVLOOP
end
EXIT

:Timer
%t = @datetime(hh:nn:ss)
dialog set,text1,%T
goto evloop

This dont work...
Back to top
View user's profile Send private message Send e-mail
Hooligan
VDS Developer
VDS Developer


Joined: 28 Oct 2003
Posts: 477
Location: California

PostPosted: Thu Jan 13, 2005 6:36 pm    Post subject: Reply with quote

Here I see what was being done. (I was unaware of this thread, when I replied to filip in the general forum...)

filip,
Under the timer label you're trying to set the text1 element, which is only valid in the main dialog, not the child dialog.

Hooligan

_________________
Hooligan

Why be normal?
Back to top
View user's profile Send private message
filip
Valued Contributor
Valued Contributor


Joined: 07 Aug 2004
Posts: 340

PostPosted: Fri Jan 14, 2005 8:48 am    Post subject: Reply with quote

yes yes

if main window have timer
child window close OK
main window Error at line: DIALOG SELECT, %d

have anyone any good tips for this problem


TITLE By Mac
DIALOG CREATE,Main,-1,0,200,100
DIALOG ADD,BUTTON,Child,5,5,150,20,"Open Child Window"
dialog add,text,text1,30,0
DIALOG SHOW

:EVLOOP
WAIT EVENT,1
rem -- %e is event, %d is dialog number that issued it (0,1,2,etc.) --
PARSE "%e;%d", @event(d)
DIALOG SELECT, %d
goto %e

:Timer
%t = @datetime(hh:nn:ss)
dialog set,text1,%T
goto evloop

:ChildBUTTON
rem -- Allow only one --
if @not(@winexists("Child"))
DIALOG CREATE,"Child",-1,0,100,50,NOMIN
DIALOG ADD,BUTTON,Test,5,5,50,20
DIALOG SHOW
end
goto EVLOOP

:TestBUTTON
INFO Dialog = %d@cr()@cr()Event = %e@tab()
goto EVLOOP

:CLOSE
if @greater(%d, 0)
DIALOG CLOSE
rem -- Kill extra CLOSE event -
%e = @event()
goto EVLOOP
end
EXIT
Back to top
View user's profile Send private message Send e-mail
filip
Valued Contributor
Valued Contributor


Joined: 07 Aug 2004
Posts: 340

PostPosted: Fri Jan 14, 2005 3:43 pm    Post subject: Reply with quote

TITLE By Mac
DIALOG CREATE,Main,-1,0,200,100
DIALOG ADD,BUTTON,Child,5,5,150,20,"Open Child Window"
dialog add,text,text1,30,0,,,
DIALOG SHOW

:EVLOOP
WAIT EVENT,0
rem -- %e is event, %d is dialog number that issued it (0,1,2,etc.) --
PARSE "%e;%d", @event(d)
if @equal(%e, "TIMER")
goto TIMER
end
DIALOG SELECT, %d
goto %e


:Timer
%t = @datetime(hh:nn:ss)
dialog set,text1,%T
goto evloop

:ChildBUTTON
rem -- Allow only one --
if @not(@winexists("Child"))
DIALOG CREATE,"Child",-1,0,100,50,NOMIN
DIALOG ADD,BUTTON,Test,5,5,50,20
dialog add,text,text1,-100,-100,,,
DIALOG SHOW
end
goto EVLOOP

:TestBUTTON
INFO Dialog = %d@cr()@cr()Event = %e@tab()
goto EVLOOP

:CLOSE
if @greater(%d, 0)
DIALOG CLOSE
rem -- Kill extra CLOSE event -
%e = @event()
goto EVLOOP
end
EXIT

Now its working but only with hiden timer on child window.

Does anyone have any more professional idea...this is only bypass fix
Back to top
View user's profile Send private message Send e-mail
Hooligan
VDS Developer
VDS Developer


Joined: 28 Oct 2003
Posts: 477
Location: California

PostPosted: Fri Jan 14, 2005 3:54 pm    Post subject: Reply with quote

At this point, what exactly is it that you would like it to do?

Hooligan

_________________
Hooligan

Why be normal?
Back to top
View user's profile Send private message
filip
Valued Contributor
Valued Contributor


Joined: 07 Aug 2004
Posts: 340

PostPosted: Fri Jan 14, 2005 4:18 pm    Post subject: Reply with quote

Watch Butterfly Effect movie...it has 2 ends and multi scenarios storie.
Back to top
View user's profile Send private message Send e-mail
Hooligan
VDS Developer
VDS Developer


Joined: 28 Oct 2003
Posts: 477
Location: California

PostPosted: Fri Jan 14, 2005 5:12 pm    Post subject: Reply with quote

And how does this relate to opening child dialogs?

Hooligan

_________________
Hooligan

Why be normal?
Back to top
View user's profile Send private message
Mac
Professional Member
Professional Member


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

PostPosted: Sun Jan 16, 2005 5:37 pm    Post subject: Reply with quote

filip,

VDS can ONLY communicate with the selected window.

You can select each window under the TIMER label and send
messages to both the main and child windows:

Code:

TITLE By Mac
DIALOG CREATE,Main,-1,0,200,100
  DIALOG ADD,BUTTON,Child,5,5,150,20,"Open Child Window"
  DIALOG ADD,STATUS,Stat1
DIALOG SHOW

:EVLOOP
  WAIT EVENT, 1
  rem -- %e is event, %d is dialog number that issued it (0,1,2,etc.) --
  PARSE "%e;%d", @event(d)
  if @equal(%e, "TIMER")
     goto TIMER
  end
  DIALOG SELECT, %d
  goto %e

:TIMER
  DIALOG SELECT, 0
  DIALOG SET, Stat1, "Timer test "@datetime(nn:ss)
  if @winexists("Child")
     DIALOG SELECT, 1
     DIALOG SET, Stat2, "Child timer test "@datetime(ss)
  end
  goto EVLOOP

:ChildBUTTON
  rem -- Allow only one --
  if @not(@winexists("Child"))
     DIALOG CREATE,"Child",-1,0,150,50,NOMIN
       DIALOG ADD,BUTTON,Test,5,5,50,20
       DIALOG ADD,STATUS,Stat2
     DIALOG SHOW
  end
  goto EVLOOP

:TestBUTTON
  INFO Dialog = %d@cr()@cr()Event = %e@tab()
  goto EVLOOP

:CLOSE
  if @greater(%d, 0)
     DIALOG CLOSE
     rem -- Kill extra CLOSE event -
     %e = @event()
     goto EVLOOP
  end
  EXIT


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 -> Visual DialogScript 3 Source Code 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