Disabling items in a wx.Choice control

Not that I know for selected items.
The only possibility I see is to lay wx.TextCtrls with the same text and the desired background colour over the disabled items, but I lack the necessary knowledge of the painting process to calculate size and position of these controls. Sorry.

···

2008/5/29 Timothy Grant timothy.grant@gmail.com:

On Thu, May 29, 2008 at 1:05 PM, raffaello barbarossa.platz@gmail.com wrote:

I would love a way of disabling some choices in a wx.Choice control

  1. Store the actual value of choice.GetSelection() in a variable ex_sel
  2. Intercept in a handler the event wx.EVT_CHOICE
  3. If the user’s selection falls in the disabled ones, event.Skip(False) and choice.SetSelection(ex_sel)
  4. Else, event.Skip(True) and ex_sel = event.GetSelection()

what is the canonical method of adding and removing items from a wx.Choice control?

wx.Choice derives from wx.ControlWithItems: use the methods Append(), Insert() and Delete()

2008/5/29 Timothy Grant timothy.grant@gmail.com:

I don’t think this is possible, but I would love a way of disabling some choices in a wx.Choice control. Failing that, what is the canonical method of adding and removing items from a wx.Choice control?


Stand Fast,
tjg.

Thank you so very much for your help on both questions.

Now I have a followup on the first one. Is it possible to “grey” out the text of some items in the Choice?


Stand Fast,
tjg.


wxpython-users mailing list

wxpython-users@lists.wxwidgets.org

http://lists.wxwidgets.org/mailman/listinfo/wxpython-users