| View previous topic :: View next topic |
| Author |
Message |
vtol Valued Contributor


Joined: 05 Feb 2004 Posts: 656 Location: Eastern Indiana
|
Posted: Sat Apr 10, 2004 11:28 pm Post subject: How can I resiz |
|
|
This is the first time I'm trying to resize one of my programs, I been putting this venture of for quite some time
I need the @dlgpos() added to my example below to enable me to learn the RESIZABLE style
Below is all I got, I need someone to fill in the blanks please:
| Code: | DIALOG CREATE,test,-1,0,400,175,resizable
DIALOG ADD,LINE,LINE1,5,5,390,135
DIALOG ADD,LIST,box1,15,11,378,115,,,DBLCLICK,MULTI
DIALOG ADD,BUTTON,cancel,148,285,43,19,Exit,,
DIALOG SHOW
DIALOG SET,box1,Hello","@FILL(4,,L) double click here"..."
:EVLOOP
WAIT EVENT
GOTO @EVENT()
:resize
rem I need the @dlgpos() put in here somehow, I think..
goto evloop
:box1DBLCLICK
info hello
goto evloop
:cancelBUTTON
:close
exit |
The problem is it don't all stretch together.
Thanks for reading this 
Last edited by vtol on Sun Apr 11, 2004 1:27 am; edited 1 time in total |
|
| Back to top |
|
 |
vtol Valued Contributor


Joined: 05 Feb 2004 Posts: 656 Location: Eastern Indiana
|
Posted: Sun Apr 11, 2004 1:23 am Post subject: |
|
|
On the above EXAMPLE the LIST box don't stretch with the MAIN dialog
Can anyone help please  |
|
| Back to top |
|
 |
Serge Professional Member


Joined: 04 Mar 2002 Posts: 1480 Location: Australia
|
|
| Back to top |
|
 |
vtol Valued Contributor


Joined: 05 Feb 2004 Posts: 656 Location: Eastern Indiana
|
Posted: Sun Apr 11, 2004 2:39 am Post subject: |
|
|
Below is the script I found on the forum:
| Code: | rem -- Only uses specs on DIALOG ADD that don't change on resize --
OPTION SCALE, 96
OPTION DECIMALSEP, "."
TITLE By Mac
DIALOG CREATE,"Test Program",-1,0,500,340,RESIZABLE
%%win = @winexists("Test Program")
DIALOG ADD,LIST,L1,60,4,0,0
DIALOG ADD,LIST,L2,60,100,0,0
DIALOG ADD,BUTTON,B1,60,0,64,24,"B1"
DIALOG ADD,BUTTON,B2,88,0,64,24,"B2"
DIALOG ADD,BUTTON,B3,116,0,64,24,"B3"
DIALOG ADD,PROGRESS,Prog1,0,0,0,20,0
DIALOG SHOW
:RESIZE
rem -- current window width/height/center(x) - locate elements with these --
%%width = @winpos(%%win, W)
%%height = @winpos(%%win, H)
%%center = @div(%%width, 2)
rem -- stuff on left of center --
DIALOG SETPOS,L1,,,@diff(%%center, 40),@diff(%%height, 128)
rem -- stuff in center --
DIALOG SETPOS,B1,,@diff(%%center, 32)
DIALOG SETPOS,B2,,@diff(%%center, 32)
DIALOG SETPOS,B3,,@diff(%%center, 32)
DIALOG SETPOS,Prog1,@diff(%%height, 60),,%%width
rem -- stuff on right of center --
DIALOG SETPOS,L2,,@sum(%%center, 36),@diff(%%width, @sum(%%center, 4 ),@diff(%%height, 128)
rem -- make minimum size 220 x 200 --
if @greater(220, %%width)
DIALOG SETPOS,,,,220
end
if @greater(200, %%height)
DIALOG SETPOS,,,,,200
end
:EVLOOP
WAIT EVENT
goto @event()
:B1BUTTON
info Width = %%width@CR()Height = %%height@cr()Center = %%center
goto EVLOOP
:B2BUTTON
info Width = %%width@CR()Height = %%height@cr()Center = %%center
goto EVLOOP
:B3BUTTON
info Width = %%width@CR()Height = %%height@cr()Center = %%center
goto EVLOOP
:CLOSE
EXIT |
I've heard this topic was discussed a lot, but I wasnt here and my search forum abiltys are poor
This seems to be the best Reziable style example here at the forum, but it don't explain how it all works too good, for one thing thing the number 40 and 128 is unexplained in the line:
| Code: | | DIALOG SETPOS,L1,,,@diff(%%center, 40),@diff(%%height, 128) |
I won't be able to learn how Resize works with out knowing where all the equations come from.
Thanks  |
|
| Back to top |
|
 |
vtol Valued Contributor


Joined: 05 Feb 2004 Posts: 656 Location: Eastern Indiana
|
Posted: Sun Apr 11, 2004 3:51 am Post subject: |
|
|
Well I transposed it to my script and as I figured it won't work till I find out where the numbers 40 128 and 32 came from
| Code: | DIALOG CREATE,test,-1,0,400,175,resizable
DIALOG ADD,LINE,LINE1,5,5,390,135
DIALOG ADD,LIST,box1,15,11,,,,,
DIALOG ADD,BUTTON,cancel,148,285,43,19,Exit,,
DIALOG SHOW
%%win = @winexists("test")
:EVLOOP
WAIT EVENT
GOTO @EVENT()
:RESIZE
rem -- current window width/height/center(x) - locate elements with these --
%%width = @winpos(%%win,W)
%%height = @winpos(%%win,H)
%%center = @div(%%width,2)
rem -- stuff on left of center --
DIALOG SETPOS,box1,,,@diff(%%center,40),@diff(%%height,128)
rem -- stuff in center --
DIALOG SETPOS,cancel,,@diff(%%center, 32)
goto evloop
:cancelBUTTON
:close
exit |
It still don't work right  |
|
| Back to top |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Sun Apr 11, 2004 5:47 am Post subject: |
|
|
If ya look in the help file under "DIALOG", you'll see what the
"DIALOG SETPOS" params are. Those you asked about are the
ones that change in relation to the size of the window. It uses
a %%center var (50% of the window width) to make things
easier than doing the repositioning from the dialog height and
width alone. On complex dialogs you might want to use several
percentage vars (10%, 25%, etc.) as markers - possibly on both
width and height.
stuff on left of center changes the width of the edit and list
elements on the left side. The EDITs top/left/height pos remain
unchanged. The LIST has its height adjusted as well, according
to the window height. The "40" numbers are how far left of center
the right side is to be, the "128" is the difference between the
listbox height and the dialog window's height.
stuff in center - the buttons they are centered using the
width of the window. "32" is half the width of the buttons since
we want the middle of the button in the center of the dialog
window. The progress bar keeps it's top pos "60" above the
window bottom (subtracts from the window height), and uses
the window width as its own.
stuff on right of center is the list on the right. Since the dialog
resizes from the lower right, the top remains unchanged, but the
left/width/height must all be adjusted. Same principle as the rest,
the numbers are in relation to the dialog window's center and size.
Bear in mind that title bar height, window borders, large fonts,
screen resolution, etc. will vary the actual results ya get with
VDS window size/dimensions on different systems.
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 |
|
 |
Skit3000 Admin Team

Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
Posted: Sun Apr 11, 2004 10:16 am Post subject: |
|
|
Vtol777, you can use this code with the first example you gave:
| Code: | :resize
dialog setpos,cancel,@diff(@dlgpos(,h),27),@diff(@dlgpos(,w),115)
dialog setpos,line1,5,5,@diff(@dlgpos(,w),10),@diff(@dlgpos(,h),40)
dialog setpos,box1,15,11,@diff(@dlgpos(,w),22),@diff(@dlgpos(,h),60)
goto evloop |
It uses dialog setpos to set the position of the elements. @dlgpos(,h) will retrieve the height of the dialog, since there is no element name given with the first parameter. With this, you can count the difference between the, for example, list and the dialog, which will be the new size...  _________________ [ Add autocomplete functionality to your VDS IDE windows! ]
Voor Nederlandse beginners met VDS: bekijk ook eens deze tutorial! |
|
| Back to top |
|
 |
vtol Valued Contributor


Joined: 05 Feb 2004 Posts: 656 Location: Eastern Indiana
|
Posted: Sun Apr 11, 2004 8:52 pm Post subject: |
|
|
I liked your information MAC, very much, and read it somewhere else on the forum, but how come Skit3000 numbers add up and yours didn't ?
| Quote: | MAC said:
the "128" is the difference between the
listbox height and the dialog window's height.
DIALOG CREATE,"Test Program",-1,0,500,340,RESIZABLE
DIALOG ADD,LIST,L1,60,4,0,0
I see the difference between the listbox height the dialog window's height equaling 340, not 128 ??? |
Thanks Skit3000 and MAC  |
|
| Back to top |
|
 |
vtol Valued Contributor


Joined: 05 Feb 2004 Posts: 656 Location: Eastern Indiana
|
Posted: Sun Apr 11, 2004 9:02 pm Post subject: |
|
|
Hey Skit3000, I paste your answer into my script, it worked perfectly and seems so easy to understand.
Will your your example work with other scripts as well, I mean if I transpose and adjust it - etc..
It seems pritty much simple to understand  |
|
| Back to top |
|
 |
vtol Valued Contributor


Joined: 05 Feb 2004 Posts: 656 Location: Eastern Indiana
|
Posted: Sun Apr 11, 2004 9:15 pm Post subject: |
|
|
Heres the result RISIZABLE good simple EXAMPLE:
| Code: | DIALOG CREATE,test,-1,0,400,175,resizable
DIALOG ADD,LINE,LINE1,5,5,390,135
rem below (LIST box1)line is before RESIZABLE is applied..
rem DIALOG ADD,LIST,box1,15,11,378,115,,,DBLCLICK,MULTI
rem next line below is after RESIZABLE is applied..
rem vds does this kinda secretly without telling you during compile!
DIALOG ADD,LIST,box1,15,11,,,,,
DIALOG ADD,BUTTON,cancel,148,285,43,19,Exit,,
DIALOG SHOW
:EVLOOP
WAIT EVENT
GOTO @EVENT()
:RESIZE
dialog setpos,cancel,@diff(@dlgpos(,h),27),@diff(@dlgpos(,w),115)
dialog setpos,line1,5,5,@diff(@dlgpos(,w),10),@diff(@dlgpos(,h),40)
dialog setpos,box1,15,11,@diff(@dlgpos(,w),22),@diff(@dlgpos(,h),60)
goto evloop
:cancelBUTTON
:close
exit |
| Quote: | Skit3000:
It uses dialog setpos to set the position of the elements. @dlgpos(,h) will retrieve the height of the dialog, since there is no element name given with the first parameter. With this, you can count the difference between the, for example, list and the dialog, which will be the new size... |
Last edited by vtol on Sun Apr 11, 2004 10:57 pm; edited 3 times in total |
|
| Back to top |
|
 |
vtol Valued Contributor


Joined: 05 Feb 2004 Posts: 656 Location: Eastern Indiana
|
Posted: Sun Apr 11, 2004 9:46 pm Post subject: |
|
|
I think I see where the comunication breakdown occurs in RESIZABLE
Heres my original line:
| Code: | | DIALOG ADD,LIST,box1,15,11,378,115,,,DBLCLICK,MULTI |
Then heres the line after RESIZABLE is applied:
| Code: | rem below line is before RESIZABLE is applied..
rem DIALOG ADD,LIST,box1,15,11,378,115,,,DBLCLICK,MULTI
rem Next line below is after RESIZABLE is applied(script compiled)..
DIALOG ADD,LIST,box1,15,11,,,,, |
VDS edits the line without telling you, therefore dumbys like me are confused even more without warning
BUTTONS:
| Quote: | | And don't forget the BUTTON H and W are switched around opposite from the way LIST box are, and you use the 1st 2 sets of numbers instead of the last set of numbers.(Height and Width numbers.) |
Thats why MACS numbers never added up, when actually did...
I re-edit the above EXAMPLE script so this information is included in it also. 
Last edited by vtol on Mon Apr 12, 2004 6:02 am; edited 2 times in total |
|
| Back to top |
|
 |
vtol Valued Contributor


Joined: 05 Feb 2004 Posts: 656 Location: Eastern Indiana
|
Posted: Mon Apr 12, 2004 4:42 am Post subject: |
|
|
I got it all transposed and it all works great on my program, but I'm having trouble with the SHAPE and Gradient Dialogs.
| Code: | | dialog ADD,SHAPE,background,0,0,588,389,green,blue |
| Code: | :RESIZE
dialog setpos,background,@diff(@dlgpos(,h),1),@diff(@dlgpos(,w),1) |
With the above method, the SHAPE dialog simply disappears completely
Do they need a different approach ? |
|
| Back to top |
|
 |
vtol Valued Contributor


Joined: 05 Feb 2004 Posts: 656 Location: Eastern Indiana
|
Posted: Mon Apr 12, 2004 6:30 am Post subject: |
|
|
Here's an EXAMPLE that works part way with the SHAPE DIALOG:
| Code: | DIALOG CREATE,test,-1,0,400,175,resizable
DIALOG ADD,LINE,LINE1,5,5,390,135
dialog ADD,SHAPE,background,0,0,399,174,green,blue
DIALOG ADD,LIST,box1,15,11,,,,,
DIALOG ADD,BUTTON,cancel,148,285,43,19,Exit,,
DIALOG SHOW
:EVLOOP
WAIT EVENT
GOTO @EVENT()
:RESIZE
dialog setpos,background,@diff(@dlgpos(,h),175),@diff(@dlgpos(,w),400)
dialog setpos,cancel,@diff(@dlgpos(,h),27),@diff(@dlgpos(,w),115)
dialog setpos,line1,5,5,@diff(@dlgpos(,w),10),@diff(@dlgpos(,h),40)
dialog setpos,box1,15,11,@diff(@dlgpos(,w),22),@diff(@dlgpos(,h),60)
goto evloop
:cancelBUTTON
:close
exit |
Anyone see whats wrong with the SHAPE DIALOG ? |
|
| Back to top |
|
 |
vtol Valued Contributor


Joined: 05 Feb 2004 Posts: 656 Location: Eastern Indiana
|
Posted: Mon Apr 12, 2004 6:58 am Post subject: |
|
|
| Code: | DIALOG CREATE,test,-1,0,400,175,resizable
DIALOG ADD,LINE,LINE1,5,5,390,135
DIALOG ADD, GRADIENT,cool,-70,0,589,410,red,blue,,topTObottom
DIALOG ADD, GRADIENT,cool2,342,0,589,350,blue,red,,topTObottom
DIALOG ADD,LIST,box1,15,11,,,,,
DIALOG ADD,BUTTON,cancel,148,285,43,19,Exit,,
DIALOG SHOW
:EVLOOP
WAIT EVENT
GOTO @EVENT()
:RESIZE
dialog setpos,cancel,@diff(@dlgpos(,h),27),@diff(@dlgpos(,w),115)
dialog setpos,line1,5,5,@diff(@dlgpos(,w),10),@diff(@dlgpos(,h),40)
dialog setpos,box1,15,11,@diff(@dlgpos(,w),22),@diff(@dlgpos(,h),60)
goto evloop
:cancelBUTTON
:close
exit |
How would the Gradients be set up in the :RESIZE label ? |
|
| Back to top |
|
 |
Garrett Moderator Team
Joined: 04 Oct 2001 Posts: 2149 Location: A House
|
Posted: Mon Apr 12, 2004 7:11 am Post subject: |
|
|
| Code: | DIALOG CREATE,test,-1,0,400,175,resizable
DIALOG ADD,LINE,LINE1,5,5,@diff(@dlgpos(,w),10),@diff(@dlgpos(,h),40)
DIALOG ADD, GRADIENT,cool,-70,0,@dlgpos(,w),@sum(@dlgpos(,h),20),red,blue,,topTObottom
DIALOG ADD, GRADIENT,cool2,@fsub(@dlgpos(,h),52),0,@dlgpos(,w),350,blue,red,,topTObottom
DIALOG ADD,LIST,box1,15,11,@diff(@dlgpos(,w),22),@diff(@dlgpos(,h),60)
DIALOG ADD,BUTTON,cancel,@diff(@dlgpos(,h),27),@diff(@dlgpos(,w),115),43,19,Exit,,
DIALOG SHOW
:EVLOOP
WAIT EVENT
GOTO @EVENT()
:RESIZE
DIALOG SETPOS,cool,-70,0,@dlgpos(,w),@sum(@dlgpos(,h),20)
DIALOG SETPOS,cool2,@fsub(@dlgpos(,h),52),0,@dlgpos(,w),350
dialog setpos,cancel,@diff(@dlgpos(,h),27),@diff(@dlgpos(,w),115)
dialog setpos,line1,5,5,@diff(@dlgpos(,w),10),@diff(@dlgpos(,h),40)
dialog setpos,box1,15,11,@diff(@dlgpos(,w),22),@diff(@dlgpos(,h),60)
goto evloop
:cancelBUTTON
:close
exit |
_________________ 'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.) |
|
| 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
|
|