WidgetCoder Contributor


Joined: 28 May 2002 Posts: 126 Location: CO, USA
|
Posted: Wed May 03, 2006 10:50 pm Post subject: |
|
|
Sorry, I misread your original message, I wouldn't recommend SavePos on a Child. If you're just centering a child window over the parent the code below might help.
| Code: |
Title Center Child Window Demo
DIALOG CREATE,Main Window,-1,0,340,230,SAVEPOS,RESIZABLE
DIALOG ADD,STATUS,STATUS1
DIALOG ADD,BUTTON,BUTTON1,10,9,89,31,Open Child
DIALOG SHOW
:Resize
:Evloop
wait event
goto @event()
:BUTTON1BUTTON
gosub ChildOpen
goto evloop
:Close
exit
# Subroutine
:ChildOpen
parse "%T;%L;%W;%H",@dlgpos(,TLWH)
if @greater(%W,200)
%W = @div(@diff(%W,200),2)
%L = @sum(%L,%W)
end
if @greater(%H,140)
%H = @div(@diff(%H,140),2)
%T = @sum(%T,%H)
end
DIALOG CREATE,Child Window,%T,%L,200,140,,SMALLCAP,ONTOP
DIALOG SHOW
dialog select,1
:Child_Loop
wait event
parse "%E;%W",@event(D)
if @equal(%W,1)
goto Child_%E
else
beep
goto Child_Loop
end
:Child_Close
DIALOG CLOSE
repeat
wait event
parse "%E;%W",@event(D)
until @equal(CLOSE1,%E%W)
dialog select,0
exit
|
|
|