11
2+
23namespace microcode {
34 import App = microgui . App
45 import Scene = user_interface_base . Scene
@@ -14,6 +15,8 @@ namespace microcode {
1415 import TextButton = microgui . TextButton
1516 import GraphableFunction = microgui . GraphableFunction
1617 import GUIGraph = microgui . GUIGraph
18+ import RadioButtonCollection = microgui . RadioButtonCollection
19+ import RadioButton = microgui . RadioButton
1720
1821 control . singleSimulator ( ) ;
1922 const app = new App ( ) ;
@@ -22,20 +25,19 @@ namespace microcode {
2225 // Comment out the examples you aren't using:
2326
2427
25-
2628 // Example 1a:
2729
28- const simpleTextComponent = new TextBox ( {
29- alignment : GUIComponentAlignment . BOT ,
30- isActive : false ,
31- title : "Title Text :)" , // optional arg
32- text : [ "Hello there," , "I hope you are well." , "Isn't this neat?" ] , // optional arg
33- colour : 6 , // optional arg
34- xScaling : 1.7 , // optional arg
35- } )
30+ // const simpleTextComponent = new TextBox({
31+ // alignment: GUIComponentAlignment.BOT,
32+ // isActive: false,
33+ // title: "Title Text :)", // optional arg
34+ // text: ["Hello there,", "I hope you are well.", "Isn't this neat?"], // optional arg
35+ // colour: 6, // optional arg
36+ // xScaling: 1.7, // optional arg
37+ // })
3638
37- const gcs = new GUIComponentScene ( { app, components : [ simpleTextComponent ] } )
38- app . pushScene ( gcs )
39+ // const gcs = new GUIComponentScene({ app, components: [simpleTextComponent] })
40+ // app.pushScene(gcs)
3941
4042
4143
@@ -121,6 +123,42 @@ namespace microcode {
121123 // app.pushScene(gcs)
122124
123125
126+ // const buttonCollection = new ButtonCollection({
127+ // alignment: GUIComponentAlignment.TOP,
128+ // btns: [
129+ // [ // Row 1:
130+ // new Button({ icon: "accelerometer", ariaId: "0", onClick: () => basic.showNumber(0) }),
131+ // new Button({ icon: "pin_0", ariaId: "1", onClick: () => basic.showNumber(1) }),
132+ // new Button({ icon: "pin_1", ariaId: "2", onClick: () => basic.showNumber(2) }),
133+ // new Button({ icon: "pin_2", ariaId: "3", onClick: () => basic.showNumber(3) }),
134+ // ],
135+ // [ // Row 2:
136+ // new Button({ icon: "thermometer", ariaId: "4", onClick: () => basic.showNumber(4) }),
137+ // new Button({ icon: "microphone", ariaId: "5", onClick: () => basic.showNumber(5) })
138+ // ],
139+ // [ // Row 3:
140+ // new Button({ icon: "compass", ariaId: "6", onClick: () => basic.showNumber(6) }),
141+ // new Button({ icon: "compass", ariaId: "6", onClick: () => basic.showNumber(6) }),
142+ // new Button({ icon: "compass", ariaId: "6", onClick: () => basic.showNumber(6) }),
143+
144+ // ],
145+ // [ // Row 4:
146+ // new Button({ icon: "right_spin", ariaId: "7", onClick: () => basic.showNumber(7) }),
147+ // new Button({ icon: "right_turn", ariaId: "8", onClick: () => basic.showNumber(8) }),
148+ // new Button({ icon: "green_tick", ariaId: "9", onClick: () => basic.showNumber(9) })
149+ // ],
150+ // ],
151+ // isActive: true,
152+ // isHidden: false,
153+ // xScaling: 1.1,
154+ // yScaling: 1.9,
155+ // colour: 3,
156+ // })
157+
158+ // const gcs = new GUIComponentScene({ app, components: [buttonCollection] })
159+ // app.pushScene(gcs)
160+
161+
124162
125163 // Example 4: Component context: Linking a graph with a button:
126164
@@ -171,6 +209,26 @@ namespace microcode {
171209 // })
172210 // const gcs = new GUIComponentScene({ app, components: [txtBtnComp], colour: 3 })
173211 // app.pushScene(gcs)
174- }
175212
176213
214+
215+ // Example 6: RadioButtons
216+
217+ const rbc = new RadioButtonCollection ( {
218+ alignment : GUIComponentAlignment . TOP ,
219+ btns : [
220+ new RadioButton ( { text : "hi" , onClick : ( ) => { basic . showString ( "hi" ) } } ) ,
221+ new RadioButton ( { text : "hiya" , onClick : ( ) => { basic . showString ( "hiya" ) } } ) ,
222+ new RadioButton ( { text : "hello" , onClick : ( ) => { basic . showString ( "hello" ) } } ) ,
223+ new RadioButton ( { text : "hello" , onClick : ( ) => { basic . showString ( "hello" ) } } )
224+ ] ,
225+ isActive : true ,
226+ yScaling : 1.1 ,
227+ // title: "The title",
228+ colour : 3 ,
229+ } )
230+
231+ const gcs = new GUIComponentScene ( { app, components : [ rbc ] } )
232+ app . pushScene ( gcs )
233+ }
234+
0 commit comments