gui/controls/listbox.py
def _set_selection(self, index, dummy=False):
        "Sets the item at index 'n' to be the selected item."
        # only change selection if index is None and not dummy:
        if index is None:
            self.wx_obj.SetSelection(-1)
            # clean up text if control supports it:
            if hasattr(self.wx_obj, "SetValue"):
                self.wx_obj.SetValue("")
        else:
            self.wx_obj.SetSelection(index)
        # send a programmatically event (not issued by wx)
        wx_event = ItemContainerControlSelectEvent(self._commandtype,
                                                   index, self.wx_obj)
        if hasattr(self, "onchange") and self.onchange:
            # TODO: fix (should work but it doesn't):
            ## wx.PostEvent(self.wx_obj, wx_evt)
            # WORKAROUND:
            event = FormEvent(name="change", wx_event=wx_event)
            self.onchange(event)
def _set_selection(self, index, dummy=False):
        "Sets the item at index 'n' to be the selected item."
        # only change selection if index is None and not dummy:
        if index is None:
            self.wx_obj.SetSelection(-1)
            # clean up text if control supports it:
            if hasattr(self.wx_obj, "SetValue"):
                self.wx_obj.SetValue("")
        else:
            self.wx_obj.SetSelection(index)
        # send a programmatically event (not issued by wx)
        wx_event = ItemContainerControlSelectEvent(self._commandtype,
                                                   index, self.wx_obj)
        if hasattr(self, "onchange") and self.onchange:
            # TODO: fix (should work but it doesn't):
            ## wx.PostEvent(self.wx_obj, wx_evt)
            # WORKAROUND:
            event = FormEvent(name="change", wx_event=wx_event)
            self.onchange(event)
Sets the item at index 'n' to be the selected item.