View previous topic :: View next topic |
Author |
Message |
Skit3000 Admin Team
Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
Posted: Sat Sep 21, 2002 4:59 pm Post subject: New Dialog-Element ---> Pure VDS! |
|
|
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 |
|
|
LOBO Valued Contributor
Joined: 14 Mar 2002 Posts: 241 Location: Wilmington, Delaware, USA
|
Posted: Sat Sep 21, 2002 5:06 pm Post subject: |
|
|
Very nice skit |
|
Back to top |
|
|
Skit3000 Admin Team
Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
Posted: Sat Sep 21, 2002 5:21 pm Post subject: |
|
|
Thank you Lobo! |
|
Back to top |
|
|
Garrett Moderator Team
Joined: 04 Oct 2001 Posts: 2149 Location: A House
|
Posted: Sat Sep 21, 2002 6:13 pm Post subject: |
|
|
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.
-Garrett |
|
Back to top |
|
|
Mac Professional Member
Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Sat Sep 21, 2002 7:37 pm Post subject: |
|
|
Very nice skit,
You could also use text elements instead of buttons to
get a colored (or multi-colored) bar chart...
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 |
|
|
FreezingFire Admin Team
Joined: 23 Jun 2002 Posts: 3508
|
Posted: Sat Sep 21, 2002 7:39 pm Post subject: |
|
|
Yes...that is nice!
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. _________________ FreezingFire
VDSWORLD.com
Site Admin Team |
|
Back to top |
|
|
Skit3000 Admin Team
Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
Posted: Sat Sep 21, 2002 8:00 pm Post subject: |
|
|
Well, thanks guys...
Ps. FreezingFire, this is posted in the VDS 3 Forum, that's why I can't use that Shape element... |
|
Back to top |
|
|
cnodnarb Professional Member
Joined: 11 Sep 2002 Posts: 762 Location: Rockeledge, GA
|
Posted: Sun Sep 22, 2002 4:36 pm Post subject: |
|
|
I kind of updated your control, because I REALLY like it!
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 |
|
|
Skit3000 Admin Team
Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
Posted: Sun Sep 22, 2002 5:16 pm Post subject: |
|
|
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 |
|
|
Skit3000 Admin Team
Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
|
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
|
|