diff options
author | Ian C <ianc@noddybox.co.uk> | 2005-10-17 00:01:24 +0000 |
---|---|---|
committer | Ian C <ianc@noddybox.co.uk> | 2005-10-17 00:01:24 +0000 |
commit | 1d97a8ae700e0fb2e94eb30f604e54155860fae8 (patch) | |
tree | 2d587b6af4305836520548e917bd0477d7bbf8fc /simplegui | |
parent | 6060eef8fe323e721903533ab39b80f4cb9fd22e (diff) |
*** empty log message ***
Diffstat (limited to 'simplegui')
-rw-r--r-- | simplegui/test.bmx | 75 |
1 files changed, 73 insertions, 2 deletions
diff --git a/simplegui/test.bmx b/simplegui/test.bmx index 6249fd5..7f3c085 100644 --- a/simplegui/test.bmx +++ b/simplegui/test.bmx @@ -11,7 +11,7 @@ Const SCRH=600 SetGraphicsDriver GLMax2DDriver() Graphics SCRW,SCRH,32,60' Or HARDSYNC -font:TBitmapFont=TBitmapFont.Load("incbin::font.bmf",0) +Global font:TBitmapFont=TBitmapFont.Load("incbin::font.bmf",0) TGUIFont.font=font @@ -26,13 +26,24 @@ Global check2:TCheckbox=TCheckbox.Create(gui,400,20,"Check 2") Global button1:TButton=TButton.Create(gui,0,360,100,30,"Test Alerts",ButtonCallback) Global button2:TButton=TButton.Create(gui,110,360,100,30,"Quit",ButtonCallback) Global buttonlist:TButtonList=TButtonList.Create(gui,500,0,["Hidden","Globally","Widgets"],0,Null) +Global vscroll:TScrollbar=TScrollbar.Create(gui,780,20,20,200,ScrollCallback) +Global hscroll:TScrollbar=TScrollbar.Create(gui,600,220,200,20,ScrollCallback) +Global hscroll2:TScrollbar=TScrollbar.Create(gui,600,250,200,20,ScrollCallback) TLabel.Create(gui,0,60,"Float:") -Global numberf:TNumberFloat=TNumberFloat.Create(gui,80,60) +Global numberf:TNumberDouble=TNumberDouble.Create(gui,80,60) TLabel.Create(gui,0,80,"Int:") Global numberi:TNumberInt=TNumberInt.Create(gui,80,80) +vscroll.SetBar(0,20,1) +hscroll.SetBar(0,10,1) +hscroll2.SetBar(0,1,1) +numberf.minval=0 +numberf.maxval=100 +numberf.change=1 + + TLabel.Create(gui,0,100,"Float") TText.Create(gui,100,100,"",20,TText.NUMERIC) TLabel.Create(gui,0,110,"Float pos") @@ -42,6 +53,13 @@ TText.Create(gui,100,120,"",20,TText.NUMERIC|TText.INTEGER) TLabel.Create(gui,0,130,"Int pos") TText.Create(gui,100,130,"",20,TText.NUMERIC|TText.INTEGER|TText.POSITIVE) +Global textlist:TTextList=TTextList.Create(gui,0,400,100,5,TextListCallback) +Global tlscroll:TScrollbar=TScrollbar.Create(gui,101,400,10,textlist.h,TextListScrollCallback) +TButton.Create(gui,0,501,100,30,"Top Row to 3",TextTopCallback) +TButton.Create(gui,110,501,100,30,"Ens. Vis. to 6",TextEnsureCallback) + +textlist.SetOptions(["A long, long long index 0","1","2","3","4","5","6","7","8","9","10","11","12"]) +tlscroll.Setbar(0,13-5+1,1) ' Test of count-rows+1 Global dialog:TGUIHandler=TGUIHandler.Create() Global dpanel:TPanel=TPanel.Create(dialog,-1,-1,400,300) @@ -50,6 +68,10 @@ Global dnum:TNumberInt=TNumberInt.Create(dialog,dpanel.x+25,dpanel.y+25) Global dok:TButton=TButton.Create(dialog,dpanel.x+5,dpanel.y+dpanel.h-25,dpanel.w/2-10,20,"OK",Null) Global dcan:TButton=TButton.Create(dialog,dpanel.x+dpanel.w/2+5,dpanel.y+dpanel.h-25,dpanel.w/2-10,20,"Cancel",Null) +Global fname:String=Null +TButton.Create(gui,300,501,100,30,"Load",LoadCallback) +TButton.Create(gui,410,501,100,30,"Save",SaveCallback) + SetBlend(ALPHABLEND) @@ -124,3 +146,52 @@ Function Menu() EndIf EndIf End Function + +Function ScrollCallback(w:TWidget) + Local s:TScrollbar=TScrollbar(w) + numberf.value=s.GetValue() +End Function + +TButton.Create(gui,0,501,100,30,"Top Row to 3",TextTopCallback) +TButton.Create(gui,110,501,100,30,"Ens. Vis. to 6",TextEnsureCallback) + + +Function TextListCallback(w:TWidget) + Local t:TTextList=TTextList(w) + Local o:Object=t.GetSelectedItem() + Local i:Int=t.GetSelectedIndex() + GUINotify("Item=" + o.ToString() + "|index=" + i) +End Function + +Function TextListScrollCallback(w:TWidget) + Local s:TScrollbar=TScrollbar(w) + textlist.SetTopRow(s.GetValue()) +End Function + +Function TextTopCallback(w:TWidget) + textlist.SetTopRow(3) + tlscroll.SetValue(3) +End Function + +Function TextEnsureCallback(w:TWidget) + textlist.EnsureVisible(6) + tlscroll.SetValue(textlist.GetTopRow()) +End Function + +Function LoadCallback(w:TWidget) + Local f:String=GUIFileSelect("Load a file",fname,False) + + If f<>Null + GUINotify("path="+f) + fname=f + EndIf +End Function + +Function SaveCallback(w:TWidget) + Local f:String=GUIFileSelect("Save a file",fname,True) + + If f<>Null + GUINotify("path="+f) + fname=f + EndIf +End Function
\ No newline at end of file |