Sver
Full Member
Posts: 145
|
Post by Sver on Aug 31, 2020 2:08:27 GMT -5
nomainwin WindowWidth = 190 WindowHeight = 550 UpperLeftX=int((DisplayWidth-WindowWidth)/2) UpperLeftY=int((DisplayHeight-WindowHeight)/2)
'------------------------------------------------------------------------------ graphicbox #1.ch1, 80, 40, 25, 412 statictext #1.ch1T, "One" ,80, 452, 30, 20 statictext #1.level1, "0", 80, 470, 30, 20 open "Slider" for window as #1 #1, "trapclose [quit]"
#1.ch1, "when leftButtonMove check" #1.ch1, "when leftButtonDown check"
MouseY=200 'midden call check handle$,a,b wait
[quit] close #1 end
Sub check handle$,a,b if MouseY<0 then MouseY = 0 'limit the Mouse range to the size of the graphic box if MouseY>400 then MouseY = 400 'limit the Mouse range to the size of the graphic box #1.ch1, "down" #1.ch1, "fill 255 255 255" 'color1 #1.ch1, "flush" ' #1.ch1, "color 0 0 0" 'color2 #1.ch1, "backcolor 200 0 0" 'color3 #1.ch1, "place 0";" ";MouseY;" size 1" #1.ch1, "boxfilled ";23;" ";MouseY + 10 #1.ch1, "flush" level1= ((MouseY)-(2*MouseY)+200) #1.level1, level1 End Sub
|
|
|
Post by alincon on Aug 31, 2020 9:21:16 GMT -5
Looks great. How can it be connected to some action or activity, like reading a file?
|
|
|
Post by tsh73 on Aug 31, 2020 16:01:13 GMT -5
It looks like it is for getting value from user. Not for reporting value (ex. lines read) to user, like progress bar.
|
|
|
Post by tenochtitlanuk on Aug 31, 2020 16:38:32 GMT -5
It's easy to programmatically control a linear analog display like this. An example is on my website, displaying a Celsius thermometer varying up and down ( and also the code only allows you to load/run it 5 times in a kind of copy-protection) Download and unzip this fileProgress bars need a way to know how long something should take, so you can move the bar to 50% when the job is half done. In most cases this can only be approximate.
|
|
Sver
Full Member
Posts: 145
|
Post by Sver on Sept 1, 2020 3:23:25 GMT -5
In a loop, you can change a timer, color, size, duration, frequency,.....
|
|
|
Post by Brandon Parker on Sept 1, 2020 13:27:19 GMT -5
With the code above you will eventually have memory issues since you are just Flushing graphics to the GraphicBox with every call to the "check" Subroutine. A better way would be to remove the Flush in the middle of your drawing routine, add a "Flush segmentName" at the end of the routine, and add a "DelSegment segmentName" at the beginning of the routine. Here is what I mean. Doing it this way prevents memory leaks due to continuing Flushing without removal. I have named the segment "Slider" for obvious reasons ... nomainwin WindowWidth = 190 WindowHeight = 550 UpperLeftX=int((DisplayWidth-WindowWidth)/2) UpperLeftY=int((DisplayHeight-WindowHeight)/2)
'------------------------------------------------------------------------------ graphicbox #1.ch1, 80, 40, 25, 412 statictext #1.ch1T, "One" ,80, 452, 30, 20 statictext #1.level1, "0", 80, 470, 30, 20 open "Slider" for window as #1 #1, "trapclose [quit]"
#1.ch1, "when leftButtonMove check" #1.ch1, "when leftButtonDown check"
MouseY=200 'midden call check handle$,a,b wait
[quit] close #1 end
Sub check handle$,a,b #1.ch1 "DelSegment Slider" if MouseY<0 then MouseY = 0 'limit the Mouse range to the size of the graphic box if MouseY>400 then MouseY = 400 'limit the Mouse range to the size of the graphic box #1.ch1, "down" #1.ch1, "fill 255 255 255" 'color1 '#1.ch1, "flush" ' #1.ch1, "color 0 0 0" 'color2 #1.ch1, "backcolor 200 0 0" 'color3 #1.ch1, "place 0";" ";MouseY;" size 1" #1.ch1, "boxfilled ";23;" ";MouseY + 10 #1.ch1, "Flush Slider" level1= ((MouseY)-(2*MouseY)+200) #1.level1, level1 End Sub {:0) Brandon Parker
|
|