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 


New Dialog-Element ---> Pure VDS!

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Visual DialogScript 3 Source Code
View previous topic :: View next topic  
Author Message
Skit3000
Admin Team


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

PostPosted: Sat Sep 21, 2002 4:59 pm    Post subject: New Dialog-Element ---> Pure VDS! Reply with quote

Hi,

I've made a new Dialog-Element, a Chart, without a dll!
It can be very helpfull to use, and maybe also for people who want to make a 'fake' dll themself.

I tried to explain how it works. If you are missing something, please post a reply.

Code:

DIALOG CREATE,Chart element,-1,0,382,318
  DIALOG ADD,STYLE,STYLE1,,8,,WHITE,BLACK
  DIALOG ADD,EDIT,EDIT1,260,105,180,20,125
  DIALOG ADD,BUTTON,SETCHART,260,290,65,20,Set
  DIALOG ADD,COMBO,CHARTCOMBO,260,5,95,21,,LIST
  DIALOG SHOW

%%Chartpos = chart1|10|10|200|200|Chart 1|500
rem       %%Chartpos = Name | X | Y | Wid | Hei | Value | Maxvalue
rem Name             = The name of the element, like 'chart1'
rem X                = The charts' top position
rem Y                = The charts' position from the left
rem Wid              = Width
rem Hei              = Height
rem Value            = The name that will be displayed. Can be empty.
rem Maxvalue         = The highest value shown by the chart. If you use a higher one it isn't visible

rem You must give up the properties that must be shown.
rem You cannot add some later. if you want a blank one, use Name1|0 |Color
rem Usage: You must give up a name, a |, followed by the value
%%Chartitems = Name1|100|DKBLUE|Name2|200|DKRED|Name3|300|DKBLUE|Name4|50|DKRED|Name5|90|DKBLUE|Name6|258|DKRED
gosub Makechart

rem --------------------------------------------------------------------------
rem Example: (Same as above, but this on is much better looking)
rem   %%Chartpos = chart1|10|10|200|200|Chart 1|500
rem   %%Chartitems = Name1|100|Name2|200|Name3|300|Name4|50|Name5|90|Name6|258
rem   gosub Makechart
rem --------------------------------------------------------------------------
rem If you want to delete this chart use this:
rem   dialog delete,chart1
rem --------------------------------------------------------------------------

rem This will load all the items in List 9, the chart items, into CHARTCOMBO
rem If you want to use it an other way, you must know how it's build up.
rem Name |Value
rem Name1|100
rem Name2|200
rem Name3|300
gosub Setchartcombo



:Evloop
wait event
%%event = @event()
goto %%event

:Setchartbutton
rem Use this to give a chart a new value.
rem Usage:
rem   %%Setchart = Name|Value
rem   gosub Setchart
rem Where Name is the name of the chartitem

%%Setchart = @item(chartcombo)|@dlgtext(EDIT1)
gosub Setchart
goto evloop

:Setchartcombo
rem This is to set all the chart-items into the Chartcombo.
rem You don't have to use this, it is just an example.
%%repeatcounter = 0
repeat
parse "%%chartitemname",@item(9,%%repeatcounter)
list add,chartcombo,%%chartitemname
%%repeatcounter = @succ(%%repeatcounter)
until @equal(%%repeatcounter,@count(9))
rem This is to make sure that there always a selected item.
list seek,chartcombo,0
exit

:Close
exit

rem --------------------------------------------------------------------
rem - This is the main source, which must be included in every program -
rem - which must use this Chart-code.                                  -
rem --------------------------------------------------------------------

:Setchart
option fieldsep,|
parse "%%var1;%%var2",%%setchart
list seek,9,0
%%var3 = @match(9,%%var1|)
%%var3 = @succ(@index(9))
dialog set,%%name%%var3,%%var3@cr()@chr(10)%%var2
%%var2 = @fmul(@fdiv(%%height,%%maxvalue),%%var2)
%%var2 = @strdel(%%var2,@pos(@chr(46),%%var2),@len(%%var2))
dialog setpos,%%name%%var3,@fadd(@fadd(%x,@diff(%%height,%%var2)),3),@diff(@fadd(@fadd(%y,@prod(%%var3,%%breedte)),5),%%breedte),%%breedte,@diff(%%var2,6)
exit

:Makechart
option decimalsep,.
option fieldsep,|
parse "%%name;%x;%y;%%width;%%height;%%value;%%maxvalue",%%chartpos
dialog add,group,%%name,%x,%y,%%width,%%height,%%value
list create,9
repeat
parse "%1;%2;%3",%%Chartitems
rem info %1
rem info %2
rem info %3
%%Chartitems = @strdel(%%Chartitems,1,@sum(@succ(@len(%1)),@succ(@len(%2)),@succ(@len(%3))))
list add,9,%1|%2|%3
until @equal(@len(%%Chartitems),0)
%%aantal = @count(9)
%%breedte = @diff(@div(%%width,%%aantal),2)
%%var1 = 0
repeat
parse "%%this;%%hoogte;%%color",@item(9,%%var1)
%%var2 = @fmul(@fdiv(%%height,%%maxvalue),%%hoogte)
%%var2 = @strdel(%%var2,@pos(@chr(46),%%var2),@len(%%var2))
dialog add,style,style@sum(%%var1,2),,,,%%color
dialog add,Edit,%%name@succ(%%var1),@fadd(@fadd(%x,@diff(%%height,%%var2)),3),@fadd(@fadd(%y,@prod(%%var1,%%breedte)),5),%%breedte,@diff(%%var2,6),@succ(%%var1)@cr()@chr(10)%%hoogte,,style@sum(%%var1,2),MULTI
rem The next line makes sure that there isn't a event if someone presses a chartbutton.
rem You can disable this by deleting the next line:
dialog disable,%%name@succ(%%var1)
%%var1 = @succ(%%var1)
until @equal(%%var1,@count(9))
exit


EDIT1: Added the multi-color support AND a little line that will add the height to a chart...


Last edited by Skit3000 on Sun Sep 22, 2002 5:20 pm; edited 1 time in total
Back to top
View user's profile Send private message
LOBO
Valued Contributor
Valued Contributor


Joined: 14 Mar 2002
Posts: 241
Location: Wilmington, Delaware, USA

PostPosted: Sat Sep 21, 2002 5:06 pm    Post subject: Reply with quote

Very nice skit Very Happy
Back to top
View user's profile Send private message AIM Address Yahoo Messenger
Skit3000
Admin Team


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

PostPosted: Sat Sep 21, 2002 5:21 pm    Post subject: Reply with quote

Thank you Lobo!
Back to top
View user's profile Send private message
Garrett
Moderator Team


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

PostPosted: Sat Sep 21, 2002 6:13 pm    Post subject: Reply with quote

Now this is what programming is about. Element for something didn't
exists, so you came up with a solution. And an excellent job on the
chart at that. Smile


-Garrett
Back to top
View user's profile Send private message
Mac
Professional Member
Professional Member


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

PostPosted: Sat Sep 21, 2002 7:37 pm    Post subject: Reply with quote

Very nice skit, Smile

You could also use text elements instead of buttons to
get a colored (or multi-colored) bar chart... 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
FreezingFire
Admin Team


Joined: 23 Jun 2002
Posts: 3508

PostPosted: Sat Sep 21, 2002 7:39 pm    Post subject: Reply with quote

Yes...that is nice! Smile

To add to Mac's Post, if you have the "Shape" element available to you you can also use that for extra features, including the rounded edges that buttons have. Smile

_________________
FreezingFire
VDSWORLD.com
Site Admin Team
Back to top
View user's profile Send private message Visit poster's website
Skit3000
Admin Team


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

PostPosted: Sat Sep 21, 2002 8:00 pm    Post subject: Reply with quote

Well, thanks guys... Smile

Ps. FreezingFire, this is posted in the VDS 3 Forum, that's why I can't use that Shape element...
Back to top
View user's profile Send private message
cnodnarb
Valued Contributor
Valued Contributor


Joined: 11 Sep 2002
Posts: 641
Location: Evansville, IN

PostPosted: Sun Sep 22, 2002 4:36 pm    Post subject: Reply with quote

I kind of updated your control, because I REALLY like it! Wink

Hope you don't mind!!

Code:

DIALOG CREATE,Chart element,-1,0,382,318
  DIALOG ADD,STYLE,STYLE1,,8,,WHITE,BLACK
  DIALOG ADD,EDIT,EDIT1,260,105,180,20,125
  DIALOG ADD,BUTTON,SETCHART,260,290,65,20,Set
  DIALOG ADD,COMBO,CHARTCOMBO,260,5,95,21,,LIST
  DIALOG SHOW

%%Chartpos = chart1|10|10|200|200|Chart 1|500
rem       %%Chartpos = Name | X | Y | Wid | Hei | Value | Maxvalue
rem Name             = The name of the element, like 'chart1'
rem X                = The charts' top position
rem Y                = The charts' position from the left
rem Wid              = Width
rem Hei              = Height
rem Value            = The name that will be displayed. Can be empty.
rem Maxvalue         = The highest value shown by the chart. If you use a higher one it isn't visible

rem You must give up the properties that must be shown.
rem You cannot add some later. if you want a blank one, use Name1|0
rem Usage: You must give up a name, a |, followed by the value
%%Chartitems = Name1|100|DKBLUE|Name2|200|DKRED|Name3|300|DKBLUE|Name4|50|DKRED|Name5|90|DKBLUE|Name6|258|DKRED
gosub Makechart

rem --------------------------------------------------------------------------
rem Example: (Same as above, but this on is much better looking)
rem   %%Chartpos = chart1|10|10|200|200|Chart 1|500
rem   %%Chartitems = Name1|100|Name2|200|Name3|300|Name4|50|Name5|90|Name6|258
rem   gosub Makechart
rem --------------------------------------------------------------------------
rem If you want to delete this chart use this:
rem   dialog delete,chart1
rem --------------------------------------------------------------------------

rem This will load all the items in List 9, the chart items, into CHARTCOMBO
rem If you want to use it an other way, you must know how it's build up.
rem Name |Value
rem Name1|100
rem Name2|200
rem Name3|300
gosub Setchartcombo



:Evloop
wait event
%%event = @event()
goto %%event

:Setchartbutton
rem Use this to give a chart a new value.
rem Usage:
rem   %%Setchart = Name|Value
rem   gosub Setchart
rem Where Name is the name of the chartitem

%%Setchart = @item(chartcombo)|@dlgtext(EDIT1)
gosub Setchart
goto evloop

:Setchartcombo
rem This is to set all the chart-items into the Chartcombo.
rem You don't have to use this, it is just an example.
%%repeatcounter = 0
repeat
parse "%%chartitemname",@item(9,%%repeatcounter)
list add,chartcombo,%%chartitemname
%%repeatcounter = @succ(%%repeatcounter)
until @equal(%%repeatcounter,@count(9))
rem This is to make sure that there always a selected item.
list seek,chartcombo,0
exit

:Close
exit

rem --------------------------------------------------------------------
rem - This is the main source, which must be included in every program -
rem - which must use this Chart-code.                                  -
rem --------------------------------------------------------------------

:Setchart
option fieldsep,|
parse "%%var1;%%var2",%%setchart
list seek,9,0
%%var3 = @match(9,%%var1|)
%%var3 = @succ(@index(9))
%%var2 = @fmul(@fdiv(%%height,%%maxvalue),%%var2)
%%var2 = @strdel(%%var2,@pos(@chr(46),%%var2),@len(%%var2))
dialog setpos,%%name%%var3,@fadd(@fadd(%x,@diff(%%height,%%var2)),3),@diff(@fadd(@fadd(%y,@prod(%%var3,%%breedte)),5),%%breedte),%%breedte,@diff(%%var2,6)
exit

:Makechart
option decimalsep,.
option fieldsep,|
parse "%%name;%x;%y;%%width;%%height;%%value;%%maxvalue",%%chartpos
dialog add,group,%%name,%x,%y,%%width,%%height,%%value
list create,9
repeat
parse "%1;%2;%3",%%Chartitems
rem info %1
rem info %2
rem info %3
%%Chartitems = @strdel(%%Chartitems,1,@sum(@succ(@len(%1)),@succ(@len(%2)),@succ(@len(%3))))
list add,9,%1|%2|%3
until @equal(@len(%%Chartitems),0)
%%aantal = @count(9)
%%breedte = @diff(@div(%%width,%%aantal),2)
%%var1 = 0
repeat
parse "%%this;%%hoogte;%%color",@item(9,%%var1)
%%var2 = @fmul(@fdiv(%%height,%%maxvalue),%%hoogte)
%%var2 = @strdel(%%var2,@pos(@chr(46),%%var2),@len(%%var2))
dialog add,style,style@sum(%%var1,2),,,,%%color
dialog add,Edit,%%name@succ(%%var1),@fadd(@fadd(%x,@diff(%%height,%%var2)),3),@fadd(@fadd(%y,@prod(%%var1,%%breedte)),5),%%breedte,@diff(%%var2,6),@succ(%%var1) ,,style@sum(%%var1,2)
rem The next line makes sure that there isn't a event if someone presses a chartbutton.
rem You can disable this by deleting the next line:
dialog disable,%%name@succ(%%var1)
%%var1 = @succ(%%var1)
until @equal(%%var1,@count(9))
exit


NodNarb
Back to top
View user's profile Send private message AIM Address
Skit3000
Admin Team


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

PostPosted: Sun Sep 22, 2002 5:16 pm    Post subject: Reply with quote

Of course I don't mind! I really like your add-on!
I also made a little update... See the first post...
Back to top
View user's profile Send private message
Skit3000
Admin Team


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

PostPosted: Sun Jun 22, 2003 5:48 pm    Post subject: Reply with quote

Although this post is in the Visual DialogScript 3 Source Code forum, I just wanted to mention that I've made a VDS 5 unit which does the same. You can download it here.
_________________
[ 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
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Visual DialogScript 3 Source Code All times are GMT
Page 1 of 1

 
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