Inactive Strings in wxChoice

I would like to have choices in the drop down listed by category. Here is an
example:

Group A:
  a
  b
  c
Group B:
  d
  e
  f

I want to give have choices a,b,c,d,e,f but separated by group. Is it
possible to show Group A, Group B like in the example but have them
inactive (disabled)?

···

--
View this message in context: http://wxpython-users.1045709.n5.nabble.com/Inactive-Strings-in-wxChoice-tp5719940.html
Sent from the wxPython-users mailing list archive at Nabble.com.

Laugh, Cry, Humble Pie.

ListBoxGroup_Example.py (2.79 KB)

···

On Tuesday, January 21, 2014 3:57:45 PM UTC-6, wxnewbie wrote:

I would like to have choices in the drop down listed by category. Here is an

example:

Group A:

a

b

c

Group B:

d

e

f

I want to give have choices a,b,c,d,e,f but separated by group. Is it

possible to show Group A, Group B like in the example but have them

inactive (disabled)?

View this message in context: http://wxpython-users.1045709.n5.nabble.com/Inactive-Strings-in-wxChoice-tp5719940.html

Sent from the wxPython-users mailing list archive at Nabble.com.

Metallicow-2,

Thanks for your script but I intend to use wxChoice (drop down list). Do you
know if it is possible to disable certain choices in the drop down list? So
when the user tries to select Group A the drop down list remains open but
nothing happens (as opposed to the default behavior of choice being set and
drop down list closing)

Thanks again for your time.

···

--
View this message in context: http://wxpython-users.1045709.n5.nabble.com/Inactive-Strings-in-wxChoice-tp5719940p5719964.html
Sent from the wxPython-users mailing list archive at Nabble.com.

wxnewbie,

Given that you seem to have “categories” in your drop down list (Group A, Group B), under which there are segregated items, it seems you probably want a tree control of some sort to drop down, with Group A being one node and Group B being another node.

There are several choices to do this. In the wxPython demo, you could look at ComboTreeBox. Problem is, I’m not sure there is a “disable an item” method in the underlying TreeCtrl (which I’m surprised to find out just now), but you could simulate it yourself by greying it out and doing nothing in response to clicking on that item. For that, see here:

http://forums.wxwidgets.org/viewtopic.php?f=1&t=8016

Or you could put another kind of TreeCtrl in a ComboControl (you can put mostly anything into a comboPopup and it will pop that thing up), such as agw.CustomTreeCtrl. That one does have an EnableItem() method which you can set to False to disable the item.