aUCBLogo Demos and Tests / comboboxtest
be comboboxtest
thread [cmbtest]
end
be cmbtest
local [f cb bappend bdelete bs bs2 finish]
f=(Frame [][MyFrame]
wxDefault_Frame_Style+wxStay_on_Top
[400 300][300 200])
WindowOnClose f [finish=true]
cb=(ComboBox f [MyComboBox] [Initial string]
[ [String 1]
[and a second string]
[and the last string]
]
[ (show "MyComboBox ComboBoxSelection)
]
[ (pr [change] ComboBoxValue)
]
[ v=ComboBoxValue
(pr [enter] v)
ComboBoxAppend cb v
]
wxCB_simple)
bappend=Button f [&append item]
[ ComboBoxAppend cb se [and another item] gensym
]
bdelete=Button f [&delete last item]
[ if (ComboBoxCount cb) > 0
[ ComboBoxRemoveItem cb (ComboBoxCount cb)-1
]
]
bs=BoxSizer wxVertical
BoxSizerAdd bs cb 1 wxExpand 0
bs2=BoxSizer wxHorizontal
BoxSizerAdd bs2 bappend 1 wxExpand 0
BoxSizerAdd bs2 bdelete 1 wxExpand 0
BoxSizerAdd bs bs2 0 wxExpand 0
WindowSetSizer f bs
WindowSetClientSize f 400 300
finish=false
until [finish]
[ dispatchMessages
waituS 100000
]
end