Hello,
can you help me to create such button-type cell?
Grid with button-type cell Topic is solved
-
- wxWorld Domination!
- Posts: 1059
- Joined: Sun Dec 30, 2007 6:40 pm
- Location: Canada
Hi,
If you're okay with using a pop up menu rather than a drop down list, then:
Define your own wxGridCellRenderer for that cell (see the wxGrid sample). Use the renderer to add the icon to the font text.
Make the cell read-only, then catch the EVT_GRID_CELL_LEFT_CLICK event and display a pop-up menu.
If you go this route, you can do a few simple calculations to align the pop-up menu with the grid cell so it always shows in the same relative area on the grid.
Hope that helps,
Jim
If you're okay with using a pop up menu rather than a drop down list, then:
Define your own wxGridCellRenderer for that cell (see the wxGrid sample). Use the renderer to add the icon to the font text.
Make the cell read-only, then catch the EVT_GRID_CELL_LEFT_CLICK event and display a pop-up menu.
If you go this route, you can do a few simple calculations to align the pop-up menu with the grid cell so it always shows in the same relative area on the grid.
Hope that helps,
Jim
OS: Vista SP1, wxWidgets 2.8.7.
Thank you, Jim, I'll try.JimFairway wrote:Hi,
If you're okay with using a pop up menu rather than a drop down list, then:
Define your own wxGridCellRenderer for that cell (see the wxGrid sample). Use the renderer to add the icon to the font text.
Make the cell read-only, then catch the EVT_GRID_CELL_LEFT_CLICK event and display a pop-up menu.
If you go this route, you can do a few simple calculations to align the pop-up menu with the grid cell so it always shows in the same relative area on the grid.
Jim
-
- Super wx Problem Solver
- Posts: 264
- Joined: Mon Aug 07, 2006 3:25 pm
- Location: Baia Mare, Romania
- Contact:
Hi.
You could put a floating wxButton on top of the grid. Just create a button using the grid as parent.
Hide the button for the moment.
Catch EVT_GRID_CMD_SELECT_CELL:
1) If the cell allows the button show the button
2) Hide the button if the cell does not allow it
Another approach would be using
EVT_GRID_EDITOR_HIDDEN
EVT_GRID_EDITOR_SHOWN
Catch both events and show a custom editor maybe.
I'm not familiar with wxGRID. I just told what I would try first
Regards
You could put a floating wxButton on top of the grid. Just create a button using the grid as parent.
Hide the button for the moment.
Catch EVT_GRID_CMD_SELECT_CELL:
1) If the cell allows the button show the button
2) Hide the button if the cell does not allow it
Another approach would be using
EVT_GRID_EDITOR_HIDDEN
EVT_GRID_EDITOR_SHOWN
Catch both events and show a custom editor maybe.
I'm not familiar with wxGRID. I just told what I would try first
Regards
Software is like sex,
It's better when it's free.
~Linus Torvalds
It's better when it's free.
~Linus Torvalds
wxPropertyGrid is the answer!
http://wxpropgrid.sourceforge.net/
http://wxpropgrid.sourceforge.net/