Hi all,
sorry for a newbie question, is there a way how to make item in
wxListBox non-selectable, to disable an item? I checked
SetItemState(), but I haven't found how this could be implemented.
Thanks in advance! Martin
···
--
Martin Landa <landa.martin gmail.com> * http://gama.fsv.cvut.cz/~landa *
wx.ListBox does not allow different fonts for different items, and I don’t know enough of wx.ListBox to advise you. My crude solution, with wx,ListBox, would be to add to the wx.ListBox a tooltip (see wx.ToolTip) saying “The item x cannot be selected”. Bye
···
2008/3/24, Martin Landa landa.martin@gmail.com:
Hi,
thanks, works like a charm. I forgot to mention that I would like to
visually separate selectable and non-selectable items, e.g. grey
coloured font for non-selectable items. I wonder if wx.ListBox enables
that, or do I need wx.ListCtrl instead?
Thanks, Martin
2008/3/24, Raffaello Barella barbarossa.platz@gmail.com:
Possible. You declare at the beginning of the frame class a general
variable:
FormerSelection = wx.NOT_FOUND
Intercept in init the event wx.EVT_LISTBOX with the code:
myListBox.Bind(wx.EVT_LISTBOX, self OnEVT_LISTBOX)
Then you add:
def OnEVT_LISTBOX(self, event):
if event.GetSelection() == non-selectable: # the int index of the
forbidden item
myListBox.SetSelection(self.FormerSelection)
else:
self.FormerSelection = event.GetSelection()
event.Skip()
2008/3/24, Martin Landa landa.martin@gmail.com:
Hi all,
sorry for a newbie question, is there a way how to make item in
wxListBox non-selectable, to disable an item? I checked
SetItemState(), but I haven’t found how this could be implemented.
Thanks in advance! Martin
–
Martin Landa <landa.martin gmail.com> * http://gama.fsv.cvut.cz/~landa *
wxpython-users mailing list
wxpython-users@lists.wxwidgets.org
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users
wxpython-users mailing list
wxpython-users@lists.wxwidgets.org
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users
–
Martin Landa <landa.martin gmail.com> * http://gama.fsv.cvut.cz/~landa *
wxpython-users mailing list
wxpython-users@lists.wxwidgets.org
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users