aUCBLogo Demos and Tests / buttontest
be buttontest
btest
; thread [btest]
end
be btest
be grun :commands
GraphEnter
run :commands
updateGraph
GraphLeave
end
; local [f dist angle bfd bbk brt blt tb cb rb1 rb2 rb3
; distC angleC bclose bs bsrl finish]
comment [
bfd=(Button [][forward 10]
[ forward 10
updateGraph
] 0 [10 220])
bbk=(Button [][back 10]
[ back 10
updateGraph
] 0 [10 250])
brt=(Button [][right 30]
[ right 30
updateGraph
] 0 [10 280])
blt=(Button [][left 30]
[ left 30
updateGraph
] 0 [10 310])
]
f=(Frame [][MyFrame]
wxFrame_Tool_Window+wxCaption+wxClose_Box
+wxSystem_Menu+wxResize_Border+wxTab_traversal+wxStay_on_Top
[100 300][-1 -1])
WindowSetBackgroundColor f [.9 .9 .85]
WindowSetClientSize f 100 30*12
WindowOnClose f [finish=true]
dist=10
angle=30
bfd=Button f [&forward]
[ grun [forward dist]
]
blt=Button f [&left]
[ grun [left angle]
]
brt=Button f [&right]
[ grun [right angle]
]
bbk=Button f [&back]
[ grun [back dist]
]
tb=(ToggleButton f [&PenDown?]
[ ifelse ToggleButtonValue tb
[PenDown]
[PenUp]
] 0 [-1 -1][-1 -1])
ToggleButtonSetValue tb PenDown?
cb=CheckBox f [&shown?]
[ grun
[ ifelse CheckBoxValue cb
[showTurtle]
[hideTurtle]
]
]
CheckBoxSet cb shown?
rb1=(RadioButton f [PenPaint]
[ if RadioButtonValue rb1 [PenPaint setPC 0]
] wxRB_GROUP)
rb2=(RadioButton f [PenErase]
[ if RadioButtonValue rb2 [PenErase]
])
rb3=(RadioButton f [PenReverse]
[ if RadioButtonValue rb3 [PenReverse]
])
distC=(IntControl f [&Distance] 1 dist 100
[ dist=IntControlValue
])
WindowSetBackgroundColor distC "green
angleC=(FloatControl f [&Angle] 1 angle 360 10 2
[ angle=FloatControlValue
] 3 wxSP_Arrow_Keys [-1 -1][-1 40])
WindowSetForegroundColor angleC "red
bclose=(Button f "
[ finish=true
] 0 [-1 -1][-1 -1] wxID_Close)
bs=BoxSizer wxVertical
BoxSizerAdd bs bfd 100 wxExpand 0
bsrl=BoxSizer wxHorizontal
BoxSizerAdd bsrl blt 100 wxExpand 0
BoxSizerAdd bsrl brt 100 wxExpand 0
BoxSizerAdd bs bsrl 100 wxExpand 0
BoxSizerAdd bs bbk 100 wxExpand 0
BoxSizerAdd bs tb 100 wxExpand 0
BoxSizerAdd bs cb 100 wxExpand 0
BoxSizerAdd bs rb1 100 wxExpand 0
BoxSizerAdd bs rb2 100 wxExpand 0
BoxSizerAdd bs rb3 100 wxExpand 0
BoxSizerAdd bs distC 180 wxExpand 0
BoxSizerAdd bs angleC 180 wxExpand 0
BoxSizerAdd bs bclose 100 wxExpand 0
WindowSetSizer f bs
stop
finish=false
until [finish]
[ dispatchMessages
waituS 100000
]
end