View previous topic :: View next topic |
Author |
Message |
Mac Professional Member
Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Wed Feb 06, 2002 9:52 pm Post subject: Simple Child Window |
|
|
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.
__________________________________________________________________________________________________________________________
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 _________________ 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 |
|
|
Mac Professional Member
Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Wed Dec 11, 2002 11:30 pm Post subject: |
|
|
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 _________________ 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 |
|
|
filip Valued Contributor
Joined: 07 Aug 2004 Posts: 340
|
Posted: Thu Jan 13, 2005 9:58 am Post subject: |
|
|
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 |
|
|
Hooligan VDS Developer
Joined: 28 Oct 2003 Posts: 480 Location: California
|
Posted: Thu Jan 13, 2005 6:36 pm Post subject: |
|
|
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 |
|
|
filip Valued Contributor
Joined: 07 Aug 2004 Posts: 340
|
Posted: Fri Jan 14, 2005 8:48 am Post subject: |
|
|
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 |
|
|
filip Valued Contributor
Joined: 07 Aug 2004 Posts: 340
|
Posted: Fri Jan 14, 2005 3:43 pm Post subject: |
|
|
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 |
|
|
Hooligan VDS Developer
Joined: 28 Oct 2003 Posts: 480 Location: California
|
Posted: Fri Jan 14, 2005 3:54 pm Post subject: |
|
|
At this point, what exactly is it that you would like it to do?
Hooligan _________________ Hooligan
Why be normal? |
|
Back to top |
|
|
filip Valued Contributor
Joined: 07 Aug 2004 Posts: 340
|
Posted: Fri Jan 14, 2005 4:18 pm Post subject: |
|
|
Watch Butterfly Effect movie...it has 2 ends and multi scenarios storie. |
|
Back to top |
|
|
Hooligan VDS Developer
Joined: 28 Oct 2003 Posts: 480 Location: California
|
Posted: Fri Jan 14, 2005 5:12 pm Post subject: |
|
|
And how does this relate to opening child dialogs?
Hooligan _________________ Hooligan
Why be normal? |
|
Back to top |
|
|
Mac Professional Member
Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Sun Jan 16, 2005 5:37 pm Post subject: |
|
|
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 _________________ 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 |
|
|
|
|
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
|
|