From 6daa6ca8f55c86512d92fa187cdf21bc7c279a6a Mon Sep 17 00:00:00 2001 From: Ian C Date: Mon, 19 Sep 2005 23:24:16 +0000 Subject: Added simple number spinners --- simplegui.mod/simplegui.bmx | 172 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 172 insertions(+) (limited to 'simplegui.mod/simplegui.bmx') diff --git a/simplegui.mod/simplegui.bmx b/simplegui.mod/simplegui.bmx index 678497b..7b5e7ef 100644 --- a/simplegui.mod/simplegui.bmx +++ b/simplegui.mod/simplegui.bmx @@ -397,6 +397,178 @@ Type TButtonList Extends TWidget End Method End Type +Rem +bbdoc: A number up/down widget for floats +EndRem +Type TNumberFloat Extends TWidget + + Rem + bbdoc: The value + EndRem + Field value:Float + + Rem + bbdoc: The increment/decrement + EndRem + Field change:Float + + Rem + bbdoc: The maximum value + EndRem + Field maxval:Float + + Rem + bbdoc: The minimum value + EndRem + Field minval:Float + + Rem + bbdoc: Create a TNumber widget. + returns: The created widget. + about: @gui is the @TGUIHandler object managing this wiget. @x and @y are its position. + about: @callback is called when the value changes. + EndRem + Function Create:TNumberFloat(gui:TGUIHandler, x:Int, y:Int, callback(w:TWidget)=Null) + Local o:TNumberFloat=New TNumberFloat + o.enabled=True + o.value=0 + o.minval=0 + o.maxval=100 + o.change=10 + o.x=x + o.y=y + o.w=TGUIFont.font.MaxHeight()*2+8 + o.h=TGUIFont.font.MaxHeight()+2 + o.callback=callback + gui.Register(o) + Return o + End Function + + Method HandleClick() + Local old:Float=value + + If MouseX()old And callback<>Null + callback(Self) + EndIf + End Method + + Method Draw() + If mouse_over + If MouseX()old And callback<>Null + callback(Self) + EndIf + End Method + + Method Draw() + If mouse_over + If MouseX()