Sliders
This commit is contained in:
parent
7f9e6ea5e9
commit
d26e95b462
1 changed files with 34 additions and 1 deletions
|
|
@ -56,7 +56,7 @@ function textinput$ (x as integer,y as integer,w as integer,h as integer,__text
|
||||||
if cursor<1 then cursor=1
|
if cursor<1 then cursor=1
|
||||||
if cursor>len(text)+1 then cursor=len(text)+1
|
if cursor>len(text)+1 then cursor=len(text)+1
|
||||||
else
|
else
|
||||||
done=-1 ' Clicked outside, exit focus
|
done=-1
|
||||||
end if
|
end if
|
||||||
end if
|
end if
|
||||||
drawtextinput x,y,w,h,text,cursor
|
drawtextinput x,y,w,h,text,cursor
|
||||||
|
|
@ -162,6 +162,22 @@ function link(x,y,label as string)
|
||||||
end if
|
end if
|
||||||
end function
|
end function
|
||||||
|
|
||||||
|
function slider(x as long, y as long, w as long, value as single)
|
||||||
|
dim tmpval as single
|
||||||
|
tmpval = value
|
||||||
|
if _mousex > x and _mousey > y - 5 and _mousex < x + w and _mousey < y + 15 then
|
||||||
|
drawslider x, y, w, value, 1
|
||||||
|
if _mousebutton(1) then
|
||||||
|
tmpval = ((_mousex - x) / w) * 100
|
||||||
|
end if
|
||||||
|
else
|
||||||
|
drawslider x, y, w, value, 0
|
||||||
|
end if
|
||||||
|
if tmpval < 0 then tmpval = 0
|
||||||
|
if tmpval > 100 then tmpval = 100
|
||||||
|
slider = tmpval
|
||||||
|
end function
|
||||||
|
|
||||||
function vscrollbar(x as long,y as long,h as long,value as single)
|
function vscrollbar(x as long,y as long,h as long,value as single)
|
||||||
dim tmpval as single
|
dim tmpval as single
|
||||||
tmpval=value
|
tmpval=value
|
||||||
|
|
@ -278,6 +294,23 @@ sub drawhline(x,y,w)
|
||||||
line (x,y+1)-(x+w,y+1),backgroundcolor2
|
line (x,y+1)-(x+w,y+1),backgroundcolor2
|
||||||
end sub
|
end sub
|
||||||
|
|
||||||
|
sub drawslider(x as long, y as long, w as long, value as single, state as integer)
|
||||||
|
dim handleX as long
|
||||||
|
handleX = x + (w * (value / 100))
|
||||||
|
color backgroundcolor1
|
||||||
|
line (x, y + 4)-(x + w, y + 6), , bf
|
||||||
|
if state = 1 then color highlightcolor else color textcolor
|
||||||
|
line (x, y + 4)-(x + w, y + 6), , b
|
||||||
|
if state = 1 then
|
||||||
|
color highlightcolor
|
||||||
|
else
|
||||||
|
color textcolor
|
||||||
|
end if
|
||||||
|
line (handleX - 5, y - 2)-(handleX + 5, y + 12), , bf
|
||||||
|
color backgroundcolor1
|
||||||
|
line (handleX - 5, y - 2)-(handleX + 5, y + 12), , b
|
||||||
|
end sub
|
||||||
|
|
||||||
sub drawvbar(x as long,y as long,h as long,value as single, state as integer)
|
sub drawvbar(x as long,y as long,h as long,value as single, state as integer)
|
||||||
if state and 2 then
|
if state and 2 then
|
||||||
color backgroundcolor2
|
color backgroundcolor2
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue