Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Tue Jan 15, 2002 5:38 am Post subject: Appearing Window... |
|
|
Make your window grow from nothing (almost). I tried some changes
to make it a little more practical (hopefully). Also added a shrinking
window close at exit.
NOTE: WINDOW POSITION does not exactly use the same original
window height and width. I adjusted the width by 5, which seems OK,
but the height will need adjusting for NOTITLE style, MENU elements,
etc.
________________________________________________________________________________________________________________________________________________________
| Code: |
OPTION SCALE, 96
OPTION DECIMALSEP, "."
TITLE By Mac
%%centerX = @div(@sysinfo(SCREENWIDTH), 2)
%%centerY = @div(@sysinfo(SCREENHEIGHT), 2)
rem -- Create window with zero width and height --
DIALOG CREATE,"Main Test Window",%%centerY,%%centerX,0,0
DIALOG ADD,BUTTON,B1,0,5,40,20,
DIALOG ADD,BUTTON,B2,0,355,40,20,
DIALOG ADD,LIST,L1,25,5,390,170
DIALOG SHOW
rem -- Desired window width and height --
%%winW = 400
%%winH = 200
%x = 100
%y = 50
REPEAT
if @greater(%%winW, %x)
rem -- Must use "1" or a number that %%winW is divisible by --
%x = @sum(%x, 2)
end
if @greater(%%winH, %y)
%y = @succ(%y)
end
rem -- Window height in this line must be adjusted for NOTITLE style, MENU elements, etc. --
WINDOW POSITION,"Main Test Window",@diff(%%centerY, @div(%y,2)),@diff(%%centerX, @div(%x,2)),@sum(%x,5),@sum(%y,25)
UNTIL @both(@equal(%x, %%winW), @equal(%y, %%winH))
:B1BUTTON
:B2BUTTON
WAIT EVENT
goto @event()
:CLOSE
rem -- Quick window shrink --
%x = %%winW
%y = %%winH
REPEAT
%x = @diff(%x, 10)
%y = @diff(%y, 5)
WINDOW POSITION,"Main Test Window",@diff(%%centerY, @div(%y,2)),@diff(%%centerX, @div(%x,2)),%x,%y
UNTIL @both(@greater(100, %x), @greater(50, %y))
EXIT
|
[EDIT]
Made some changes, see top of post. _________________ 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
 |
|