Hi I have a wxDataViewCtrl. The first column is a tree. Some others columns show bitmaps. I want for some items (not all) to allow toggling between two different bitmaps. A few must allow to chose among several bitmaps. The rest of items don't show any bitmap at all.
My first idea is to derive from wxDataViewBitmapRenderer and override some methods, I don't know which one yet. And I don't know which events should I handle, EVT_DATAVIEW_ITEM_START_EDITING?
> I have a wxDataViewCtrl. The first column is a tree. Some others columns
> show bitmaps.
> I want for some items (not all) to allow toggling between two different
> bitmaps. A few must allow to chose among several bitmaps. The rest of
> items don't show any bitmap at all.
I have something similar in KiCad, maybe you can get some inspiration there:
Thanks Simon. I see in your code that you use PinTypeRenderer derived from wxDataViewCustomRenderer with all overrides the wx docs explain. The wxVariant is a "long", which I guess you use it to get/set the proper bitmap. Also, a custom ComboBox editor to chose that "long" (index in the combo).
That looks right to me. I still wonder if it can be also achieved with a custom renderer derived from wxDataViewBitmapRenderer, in the hope of saving write code that is already written.
For future readers: The key is wxDataViewCustomRenderer::ActivateCell(). It allows to do whatever you want when the user "clicks" on the cell. So I was able to do all of what I wanted deriving my own custom render from wxDataViewCustomRenderer