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 


How can I resiz
Goto page 1, 2  Next
 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
vtol
Valued Contributor
Valued Contributor


Joined: 05 Feb 2004
Posts: 656
Location: Eastern Indiana

PostPosted: Sat Apr 10, 2004 11:28 pm    Post subject: How can I resiz Reply with quote

This is the first time I'm trying to resize one of my programs, I been putting this venture of for quite some time Smile

I need the @dlgpos() added to my example below to enable me to learn the RESIZABLE style Cool

Below is all I got, I need someone to fill in the blanks please: Rolling Eyes

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 Very Happy


Last edited by vtol on Sun Apr 11, 2004 1:27 am; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website
vtol
Valued Contributor
Valued Contributor


Joined: 05 Feb 2004
Posts: 656
Location: Eastern Indiana

PostPosted: Sun Apr 11, 2004 1:23 am    Post subject: Reply with quote

On the above EXAMPLE the LIST box don't stretch with the MAIN dialog Sad

Can anyone help please Question
Back to top
View user's profile Send private message Visit poster's website
Serge
Professional Member
Professional Member


Joined: 04 Mar 2002
Posts: 1480
Location: Australia

PostPosted: Sun Apr 11, 2004 1:32 am    Post subject: Reply with quote

hi vtoll,

resizing dialogs has been covered many times Smile

check out the following links

1 http://forum.vdsworld.com/viewtopic.php?t=2446&highlight=resize

2 http://forum.vdsworld.com/viewtopic.php?t=2423&highlight=resize

they should give you an idea of how to make it work...it is not something i know off hand as i never use resizable dialogs

hope the links above will help you

serge

_________________
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
vtol
Valued Contributor
Valued Contributor


Joined: 05 Feb 2004
Posts: 656
Location: Eastern Indiana

PostPosted: Sun Apr 11, 2004 2:39 am    Post subject: Reply with quote

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, 4Cool),@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 Crying or Very sad

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. Sad

Thanks Smile
Back to top
View user's profile Send private message Visit poster's website
vtol
Valued Contributor
Valued Contributor


Joined: 05 Feb 2004
Posts: 656
Location: Eastern Indiana

PostPosted: Sun Apr 11, 2004 3:51 am    Post subject: Reply with quote

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 Crying or Very sad


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 Laughing
Back to top
View user's profile Send private message Visit poster's website
Mac
Professional Member
Professional Member


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

PostPosted: Sun Apr 11, 2004 5:47 am    Post subject: Reply with quote

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. Wink

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
Skit3000
Admin Team


Joined: 11 May 2002
Posts: 2166
Location: The Netherlands

PostPosted: Sun Apr 11, 2004 10:16 am    Post subject: Reply with quote

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... Smile

_________________
[ Add autocomplete functionality to your VDS IDE windows! ]
Voor Nederlandse beginners met VDS: bekijk ook eens deze tutorial!
Back to top
View user's profile Send private message
vtol
Valued Contributor
Valued Contributor


Joined: 05 Feb 2004
Posts: 656
Location: Eastern Indiana

PostPosted: Sun Apr 11, 2004 8:52 pm    Post subject: Reply with quote

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 Very Happy
Back to top
View user's profile Send private message Visit poster's website
vtol
Valued Contributor
Valued Contributor


Joined: 05 Feb 2004
Posts: 656
Location: Eastern Indiana

PostPosted: Sun Apr 11, 2004 9:02 pm    Post subject: Reply with quote

Hey Skit3000, I paste your answer into my script, it worked perfectly and seems so easy to understand. Cool
Will your your example work with other scripts as well, I mean if I transpose and adjust it - etc.. Idea

It seems pritty much simple to understand Very Happy
Back to top
View user's profile Send private message Visit poster's website
vtol
Valued Contributor
Valued Contributor


Joined: 05 Feb 2004
Posts: 656
Location: Eastern Indiana

PostPosted: Sun Apr 11, 2004 9:15 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
vtol
Valued Contributor
Valued Contributor


Joined: 05 Feb 2004
Posts: 656
Location: Eastern Indiana

PostPosted: Sun Apr 11, 2004 9:46 pm    Post subject: Reply with quote

I think I see where the comunication breakdown occurs in RESIZABLE Laughing

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 Embarassed Mad Rolling Eyes Laughing

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... Wink

I re-edit the above EXAMPLE script so this information is included in it also. Smile


Last edited by vtol on Mon Apr 12, 2004 6:02 am; edited 2 times in total
Back to top
View user's profile Send private message Visit poster's website
vtol
Valued Contributor
Valued Contributor


Joined: 05 Feb 2004
Posts: 656
Location: Eastern Indiana

PostPosted: Mon Apr 12, 2004 4:42 am    Post subject: Reply with quote

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 Rolling Eyes

Do they need a different approach ?
Back to top
View user's profile Send private message Visit poster's website
vtol
Valued Contributor
Valued Contributor


Joined: 05 Feb 2004
Posts: 656
Location: Eastern Indiana

PostPosted: Mon Apr 12, 2004 6:30 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
vtol
Valued Contributor
Valued Contributor


Joined: 05 Feb 2004
Posts: 656
Location: Eastern Indiana

PostPosted: Mon Apr 12, 2004 6:58 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Garrett
Moderator Team


Joined: 04 Oct 2001
Posts: 2149
Location: A House

PostPosted: Mon Apr 12, 2004 7:11 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
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