[wxPython-users] wxGrid with custom editors, several question
Basil Shubin
bashu at yandex.ru
Sun Sep 3 01:26:14 PDT 2006
Robin Dunn wrote:
> Basil Shubin wrote:
>> Hi friends!
>>
>> Lets suppose I have wxGrid with table in it. This table have some kind
>> of custom editors (choices).
>>
>> self.dataTypes = [gridlib.GRID_VALUE_CHOICE + titleChoices,
>> gridlib.GRID_VALUE_CHOICE + setChoices,
>> gridlib.GRID_VALUE_NUMBER + ':1,8',
>> gridlib.GRID_VALUE_NUMBER + ':1,30',
>> gridlib.GRID_VALUE_FLOAT + ':3,2',
>> ]
>>
>> The 'titleChoices' compiled with data collected somewere else, point
>> is that this data is not static, it's update through time. So the
>> first question is: how can I update the 'titleChoice' dynamically when
>> achieve some condition?
>
> You can catch the EVT_GRID_EDITOR_SHOWN event, get the combobox with
> event.GetControl and modify the contents of the list at that point in time.
I got following error:
AttributeError: 'GridEvent' object has no attribute 'GetControl'
So how I can take the appropriate combo box control. And when I able to
get it, how can I determine that it is a right control?
> You can also create the cell editor on the fly and return it as part of
> the cell attributes returned from the table's GetAttr method.
>
>
>>
>> Question two: how can I clean entire table in the grid, i.e. delete
>> all rows at once?
>
> Send a GridTableMessage of type GRIDTABLE_NOTIFY_ROWS_DELETED specifying
> that the deleted rows start at row zero and that the total number of
> rows in the grid were deleted.
More information about the wxpython-users
mailing list