The wxCB_SORT style does not seem to do anything in the grid editor one gets with dataType = "wxGRID_VALUE_CHOICE"
I am trying to do:
EVT_GRID_EDITOR_CREATED(self, self.SetChoiceValues)
def SetChoiceValues(self, event):
control = event.GetControl()
control.SetWindowStyle(wxCB_SORT | wxCB_READONLY)
etc ......
If I leave out the wxCB_READONLY style I do get an error, therefore I assume that the style is set, but the choices are still not sorted in any way.
Am I doing some wrong / or not doing or is this style not supported in the grid.
Best regards
Werner
Robin
2
Werner F. Bruhin wrote:
The wxCB_SORT style does not seem to do anything in the grid editor one gets with dataType = "wxGRID_VALUE_CHOICE"
I am trying to do:
EVT_GRID_EDITOR_CREATED(self, self.SetChoiceValues)
def SetChoiceValues(self, event):
control = event.GetControl()
control.SetWindowStyle(wxCB_SORT | wxCB_READONLY)
etc ......
If I leave out the wxCB_READONLY style I do get an error, therefore I assume that the style is set, but the choices are still not sorted in any way.
Most styles are only effective when the window is created.
···
--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!
Robin,
Robin Dunn wrote:
Werner F. Bruhin wrote:
The wxCB_SORT style does not seem to do anything in the grid editor one gets with dataType = "wxGRID_VALUE_CHOICE"
I am trying to do:
EVT_GRID_EDITOR_CREATED(self, self.SetChoiceValues)
def SetChoiceValues(self, event):
control = event.GetControl()
control.SetWindowStyle(wxCB_SORT | wxCB_READONLY)
etc ......
If I leave out the wxCB_READONLY style I do get an error, therefore I assume that the style is set, but the choices are still not sorted in any way.
Most styles are only effective when the window is created.
I tried the following and searched in the doc to no avail.
elif col in self.choiceColumns:
attr = wxGridCellAttr()
edClass = wxGridCellChoiceEditor
kwargsDict = {}
kwargsDict['style'] = wxCB_READONLY | wxCB_SORT
editor = apply(edClass, (), kwargsDict)
attr.SetEditor(editor)
return attr
But the wxGridCellChoiceEditor does NOT take a keyword style, at least not the way I tried to do it.
Any other good guesses
on how to solve this, or do I really have to sort this list myself before feeding it to the editor?
See you
Werner
Robin
4
Werner F. Bruhin wrote:
Any other good guesses
on how to solve this, or do I really have to sort this list myself before feeding it to the editor?
You could make your own grid editor class derived from wxPyGridCellEditor.
···
--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!