diff options
author | Ian C <ianc@noddybox.co.uk> | 2005-09-27 23:23:51 +0000 |
---|---|---|
committer | Ian C <ianc@noddybox.co.uk> | 2005-09-27 23:23:51 +0000 |
commit | b343aeaba65b6bafec58584510ea29ad65ac8737 (patch) | |
tree | 0c6dc9cb718e0859aee29b90544bd1a8f3d7f3ab /simplegui.mod | |
parent | 512895cba915f782d36a0c7de75f0dbf2a53e2c1 (diff) |
Added SetFloat() to TText
Diffstat (limited to 'simplegui.mod')
-rw-r--r-- | simplegui.mod/simplegui.bmx | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/simplegui.mod/simplegui.bmx b/simplegui.mod/simplegui.bmx index a7ca95c..79ba7eb 100644 --- a/simplegui.mod/simplegui.bmx +++ b/simplegui.mod/simplegui.bmx @@ -264,6 +264,27 @@ Type TText Extends TWidget gui.Register(o) Return o End Function + + Rem + bbdoc: Set the text to a floating point value. + about: @v is the floating point value (a double to cover both types). This value will be placed in the text + about: field with trailing zeros (and trailing dot if an integer) removed. + EndRem + Method SetFloat(v:Double) + Local s:String=v + + If s.Find(".")<>-1 + While s.length>1 And s[s.length-1]=Asc("0") + s=s[..s.length-1] + Wend + + While s.length>1 And s[s.length-1]=Asc(".") + s=s[..s.length-1] + Wend + EndIf + + text=s + End Method Method HandleClick() owner.SetFocus(Self) @@ -915,6 +936,9 @@ Function GUIMenu(title:String, options:String[], x:Int, y:Int, i:TImage=Null) Local gui:TGUIHandler=TGUIHandler.Create() + x=Max(0,Min(x,GraphicsWidth()-w)) + y=Max(0,Min(y,GraphicsHeight()-h)) + Local label:TLabel=TLabel.Create(gui,x+5,y+2,title) Local button:TButton[]=New TButton[options.length] @@ -958,6 +982,8 @@ about: @gui is the GUI handler and widgets to display as a dialog., @ok is the c about: If @i is not null then this image is drawn as a mouse cursor. EndRem Function GUIDialog(gui:TGUIHandler, ok:TWidget, cancel:TWidget, i:TImage=Null) + FlushKeys() + Local back:TImage=CreateImage(GraphicsWidth(),GraphicsHeight(),1,0) GrabImage(back,0,0) |