I have a bunch of combo box that users select from a static set of
choices. When they press the clear button on the frame, I want to
reset all the combo boxes back to the default... but I do not want to
clear all the static choices from the box! I know it sounds incredibly
simple, but I can't seem to figure out how to do this.
I have a bunch of combo box that users select from a static set of
choices. When they press the clear button on the frame, I want to
reset all the combo boxes back to the default... but I do not want to
clear all the static choices from the box! I know it sounds incredibly
simple, but I can't seem to figure out how to do this.
If you mean you want to set them back to the initial selections then
just call the ComboBox's SetSelection method to return the selection
back to whatever you initialized them to. (i.e if you didn't set an
initial selection then 'mycomobox.SetSelection(0)'.)
Also see SetStringSelection if you want to set the selection based
upon a string the control as opposed to an index.
Cody
···
On Mon, May 17, 2010 at 7:24 PM, User1101 <kevinsemailaddie@yahoo.com> wrote:
If any ComboBoxes start off blank, you'll want to call
mycombobox.SetSelection(-1).
Btw, you can do this in a loop, either by collecting your comboboxes
yourself into a list, or if they are on a common parent you can do
something like:
for object in parent.GetChildren():
if type(object) == wx._controls.ComboBox:
object.SetSelection(-1)
Che
···
On Mon, May 17, 2010 at 11:03 PM, Cody Precord <codyprecord@gmail.com> wrote:
Hi,
On Mon, May 17, 2010 at 7:24 PM, User1101 <kevinsemailaddie@yahoo.com> wrote:
I have a bunch of combo box that users select from a static set of
choices. When they press the clear button on the frame, I want to
reset all the combo boxes back to the default... but I do not want to
clear all the static choices from the box! I know it sounds incredibly
simple, but I can't seem to figure out how to do this.
If you mean you want to set them back to the initial selections then
just call the ComboBox's SetSelection method to return the selection
back to whatever you initialized them to. (i.e if you didn't set an
initial selection then 'mycomobox.SetSelection(0)'.)