summaryrefslogtreecommitdiff
path: root/simplegui.mod/doc/commands.html
blob: b8573606d0de25d9caf2902f738909cebbb1746b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
<html>
<head>
<title>BlitzMax Module Reference</title>
<link rel="stylesheet" type="text/css" href="../../../../doc/bmxstyle.css">
</head>
<body>
<h1>Function Reference</h1>
<p><div id=GUINotify class=ref>
<div class=rootdoc><font class=token>Function GUINotify( s:String, i:TImage=Null )</font> Displays a notification alert with the supplied string.</div><div class=indent><p>The string <b>s</b> can be split into multiple lines using the '|' character.  If <b>i</b> is not null then this image is drawn as a mouse cursor.</div><br></div><br>
<p><div id=GUIYesNo class=ref>
<div class=rootdoc><font class=token>Function GUIYesNo:Int( s:String, i:TImage=Null )</font> Displays a yes/no alert with the supplied string.</div><div class=indent><p><b>Returns:</b> True if Yes selected, otherwise False.<p>The string <b>s</b> can be split into multiple lines using the '|' character.  If <b>i</b> is not null then this image is drawn as a mouse cursor.</div><br></div><br>
<p><div id=GUIMenu class=ref>
<div class=rootdoc><font class=token>Function GUIMenu( title:String, options:String[], x:Int, y:Int, i:TImage=Null )</font> Displays a pop-up menu.</div><div class=indent><p><b>Returns:</b> The index of the selected option, -1 for none.<p><b>title</b> is the menu title, <b>options</b> the options to display and <b>x</b> and <b>y</b> specify its position.
If <b>i</b> is not null then this image is drawn as a mouse cursor.</div><br></div><br>
<h1>Type Reference</h1>
<p><div id=TGUIFont class=ref>
<div class=rootdoc><font class=token>Type TGUIFont</font> Defines the <b>TBitmapFont</b> to be used by the GUI.</div><div class=indent></div><br><p><div id=font>
<div class=rootdoc><font class=token>Global font:TBitmapFont</font> The font to use.</div><div class=indent></div><br></div><br>
</div><br>
<p><div id=TWidget class=ref>
<div class=rootdoc><font class=token>Type TWidget Abstract</font> The base widget type.</div><div class=indent></div><br><p><div id=enabled>
<div class=rootdoc><font class=token>Field enabled:Int</font> If true the widget is displayed and can be used.</div><div class=indent></div><br></div><br>
<p><div id=text>
<div class=rootdoc><font class=token>Field text:String</font> The text displayed in the widget.</div><div class=indent></div><br></div><br>
<p><div id=x>
<div class=rootdoc><font class=token>Field x:Int</font> The X co-ordinate of the widget.</div><div class=indent></div><br></div><br>
<p><div id=y>
<div class=rootdoc><font class=token>Field y:Int</font> The Y co-ordinate of the widget.</div><div class=indent></div><br></div><br>
<p><div id=w>
<div class=rootdoc><font class=token>Field w:Int</font> The width of the widget.</div><div class=indent></div><br></div><br>
<p><div id=h>
<div class=rootdoc><font class=token>Field h:Int</font> The height of the widget.</div><div class=indent></div><br></div><br>
<p><div id=callback>
<div class=rootdoc><font class=token>Field callback(w:TWidget)</font> Callback to call when clicked.</div><div class=indent></div><br></div><br>
<p><div id=mouse_over>
<div class=rootdoc><font class=token>Field mouse_over:Int</font> True if the mouse is over this widget, False otherwise.</div><div class=indent></div><br></div><br>
<p><div id=owner>
<div class=rootdoc><font class=token>Field owner:TGUIHandler</font> The <b>TGUIHandler</b> that owns this widget.</div><div class=indent></div><br></div><br>
<p><div id=HandleKey>
<div class=rootdoc><font class=token>Method HandleKey( k:Int )</font> Override this accept keypresses</div><div class=indent></div><br></div><br>
<p><div id=MouseEnter>
<div class=rootdoc><font class=token>Method MouseEnter()</font> Override this for when the mouse enters.  Call this parent version to handle <b>mouse_over</b> too.</div><div class=indent></div><br></div><br>
<p><div id=MouseLeave>
<div class=rootdoc><font class=token>Method MouseLeave()</font> Override this for when the mouse leaves.  Call this parent version to handle <b>mouse_over</b> too.</div><div class=indent></div><br></div><br>
<p><div id=HandleClick>
<div class=rootdoc><font class=token>Method HandleClick()</font> Override to handle a mouse button press.</div><div class=indent></div><br></div><br>
<p><div id=Draw>
<div class=rootdoc><font class=token>Method Draw()</font> Must be provided by a widget to draw itself.</div><div class=indent></div><br></div><br>
<p><div id=DrawBox>
<div class=rootdoc><font class=token>Function DrawBox( x:Int, y:Int, w:Int, h:Int )</font> Helper to draw a wireframe rectangle.</div><div class=indent></div><br></div><br>
<p><div id=Draw3DBox>
<div class=rootdoc><font class=token>Function Draw3DBox( x:Int, y:Int, w:Int, h:Int, invert:Int, size:Int=2 )</font> Helper to draw a 3D rectangle.</div><div class=indent></div><br></div><br>
</div><br>
<p><div id=TLabel class=ref>
<div class=rootdoc><font class=token>Type TLabel Extends TWidget</font> The label widget (simply displays the supplied string)</div><div class=indent></div><br><p><div id=Create>
<div class=rootdoc><font class=token>Function Create:TLabel( gui:TGUIHandler,x:Int, y:Int, text:String )</font> Create a TLabel widget.</div><div class=indent><p><b>Returns:</b> The created widget.<p><b>gui</b> is the <b>TGUIHandler</b> object managing this wiget. <b>x</b> and <b>y</b> are its position and <b>text</b> is the text to display in the label.</div><br></div><br>
</div><br>
<p><div id=TText class=ref>
<div class=rootdoc><font class=token>Type TText Extends TWidget</font> The text entry widget</div><div class=indent></div><br><p><div id=Create>
<div class=rootdoc><font class=token>Function Create:TText( gui:TGUIHandler,x:Int, y:Int, text:String, maxlen:Int, callback(w:TWidget)=Null )</font> Create a TText widget.</div><div class=indent><p><b>Returns:</b> The created widget.<p><b>gui</b> is the <b>TGUIHandler</b> object managing this wiget. <b>x</b> and <b>y</b> are its position and <b>text</b> is the initial text in the widget.
<b>maxlen</b> is the maximum number of characters allowed.  <b>callback</b> is called when RETURN is pressed in the text field.</div><br></div><br>
</div><br>
<p><div id=TCheckbox class=ref>
<div class=rootdoc><font class=token>Type TCheckbox Extends TWidget</font> The checkbox widget</div><div class=indent></div><br><p><div id=checked>
<div class=rootdoc><font class=token>Field checked:Int</font> True if the box is checked, False otherwise.</div><div class=indent></div><br></div><br>
<p><div id=Create>
<div class=rootdoc><font class=token>Function Create:TCheckbox( gui:TGUIHandler, x:Int, y:Int, text:String, callback(w:TWidget)=Null )</font> Create a TCheckox widget.</div><div class=indent><p><b>Returns:</b> The created widget.<p><b>gui</b> is the <b>TGUIHandler</b> object managing this wiget. <b>x</b> and <b>y</b> are its position and <b>text</b> is the text to display by the checkbox.
<b>callback</b> is called when the checkbox is toggled.</div><br></div><br>
</div><br>
<p><div id=TButton class=ref>
<div class=rootdoc><font class=token>Type TButton Extends TWidget</font> The button widget</div><div class=indent></div><br><p><div id=Create>
<div class=rootdoc><font class=token>Function Create:TButton( gui:TGUIHandler, x:Int, y:Int, w:Int, h:Int, text:String, callback(w:TWidget) )</font> Create a TButton widget.</div><div class=indent><p><b>Returns:</b> The created widget.<p><b>gui</b> is the <b>TGUIHandler</b> object managing this wiget. <b>x</b>, <b>y</b>, <b>w</b> and <b>h</b> are its position and size, and <b>text</b> is the text to display in the button.
<b>callback</b> is called when the button is pressed.</div><br></div><br>
</div><br>
<p><div id=TButtonList class=ref>
<div class=rootdoc><font class=token>Type TButtonList Extends TWidget</font> A drop down list type widget</div><div class=indent></div><br><p><div id=selected>
<div class=rootdoc><font class=token>Field selected:Int</font> The selected item.</div><div class=indent></div><br></div><br>
<p><div id=Create>
<div class=rootdoc><font class=token>Function Create:TButtonList( gui:TGUIHandler, x:Int, y:Int, options:String[], selected:Int, callback(w:TWidget) )</font> Create a TButtonList widget.</div><div class=indent><p><b>Returns:</b> The created widget.<p><b>gui</b> is the <b>TGUIHandler</b> object managing this wiget. <b>x</b> and <b>y</b> are its position. <b>options</b> are the options for the list and
<b>selected</b> is the currently selected item. <b>callback</b> is called when the selection changes.</div><br></div><br>
</div><br>
<p><div id=TNumberFloat class=ref>
<div class=rootdoc><font class=token>Type TNumberFloat Extends TWidget</font> A number up/down widget for floats</div><div class=indent></div><br><p><div id=value>
<div class=rootdoc><font class=token>Field value:Float</font> The value</div><div class=indent></div><br></div><br>
<p><div id=change>
<div class=rootdoc><font class=token>Field change:Float</font> The increment/decrement</div><div class=indent></div><br></div><br>
<p><div id=maxval>
<div class=rootdoc><font class=token>Field maxval:Float</font> The maximum value</div><div class=indent></div><br></div><br>
<p><div id=minval>
<div class=rootdoc><font class=token>Field minval:Float</font> The minimum value</div><div class=indent></div><br></div><br>
<p><div id=Create>
<div class=rootdoc><font class=token>Function Create:TNumberFloat( gui:TGUIHandler, x:Int, y:Int, callback(w:TWidget)=Null )</font> Create a TNumber widget.</div><div class=indent><p><b>Returns:</b> The created widget.<p><b>gui</b> is the <b>TGUIHandler</b> object managing this wiget. <b>x</b> and <b>y</b> are its position.
<b>callback</b> is called when the value changes.</div><br></div><br>
</div><br>
<p><div id=TNumberInt class=ref>
<div class=rootdoc><font class=token>Type TNumberInt Extends TWidget</font> A number up/down widget for ints</div><div class=indent></div><br><p><div id=value>
<div class=rootdoc><font class=token>Field value:Int</font> The value</div><div class=indent></div><br></div><br>
<p><div id=change>
<div class=rootdoc><font class=token>Field change:Int</font> The increment/decrement</div><div class=indent></div><br></div><br>
<p><div id=maxval>
<div class=rootdoc><font class=token>Field maxval:Int</font> The maximum value</div><div class=indent></div><br></div><br>
<p><div id=minval>
<div class=rootdoc><font class=token>Field minval:Int</font> The minimum value</div><div class=indent></div><br></div><br>
<p><div id=Create>
<div class=rootdoc><font class=token>Function Create:TNumberInt( gui:TGUIHandler, x:Int, y:Int, callback(w:TWidget)=Null )</font> Create a TNumber widget.</div><div class=indent><p><b>Returns:</b> The created widget.<p><b>gui</b> is the <b>TGUIHandler</b> object managing this wiget. <b>x</b> and <b>y</b> are its position.
<b>callback</b> is called when the value changes.</div><br></div><br>
</div><br>
<p><div id=TGUIHandler class=ref>
<div class=rootdoc><font class=token>Type TGUIHandler</font> Handles the GUI.</div><div class=indent></div><br><p><div id=Register>
<div class=rootdoc><font class=token>Method Register( w:TWidget )</font> Register a widget.</div><div class=indent><p>Widgets call this themselves.</div><br></div><br>
<p><div id=Clear>
<div class=rootdoc><font class=token>Method Clear()</font> Remove all widgets.</div><div class=indent></div><br></div><br>
<p><div id=SetEnable>
<div class=rootdoc><font class=token>Method SetEnable( state:Int )</font> Sets the enable state of all widgets.</div><div class=indent><p>If <b>state</b> is true then all widgets are enabled, otherwise all widgets are disabled</div><br></div><br>
<p><div id=SetFocus>
<div class=rootdoc><font class=token>Method SetFocus( w:TWidget )</font> Sets the keyboard focus to the supplied widget.  Pass null for no focus.</div><div class=indent></div><br></div><br>
<p><div id=GetFocus>
<div class=rootdoc><font class=token>Method GetFocus:TWidget()</font> Gets the keyboard focus.</div><div class=indent><p><b>Returns:</b> The currently focused TWidget, or null for no focus.</div><br></div><br>
<p><div id=Clicked>
<div class=rootdoc><font class=token>Method Clicked:TWidget()</font> Gets the last clicked widget.</div><div class=indent><p><b>Returns:</b> The last clicked TWidget.  Null is returned if this is called again before another widget is clicked.</div><br></div><br>
<p><div id=EventLoop>
<div class=rootdoc><font class=token>Method EventLoop()</font> Perform the event loop and pass any necessary events.</div><div class=indent><p>KeyHit(KEY_MOUSELEFT) and GetChar() are used to consume events for the interface.</div><br></div><br>
<p><div id=Create>
<div class=rootdoc><font class=token>Function Create:TGUIHandler()</font> Create a GUI Handler.</div><div class=indent><p><b>Returns:</b> The GUI Hanbler.</div><br></div><br>
</div><br>
<h1>Module Information</h1>
<table>
<tr><td><b>Framework</b></td>
<td> (Very) Simple GUI</td></tr>
<tr><td><b>Copyright</b></td>
<td> Public Domain</td></tr>
<tr><td><b>Author</b></td>
<td> Ian Cowburn</td></tr>
<tr><td><b>Version</b></td>
<td> $Revision$</td></tr>
</table>
</body>
</html>