Hidden information in wxGrid

I have a wxGrid that I fill dynamically. I would like to store some information with each line that should not be displayed to the user. What's the best way to bind data to a string? Should I just create a hidden column or is there a better way?

+1


source to share


2 answers


Making a hidden column is the fastest but very ugly method. If you can justify the effort, then you're better off creating your own base grid table class. Your own class based on wxGridTableBase can store whatever information you need without having to display it in the grid. Unfortunately, the documentation for this class is sparse or almost nonexistent.

For an example, see the grid demo in the wxWidgets sample directory, specifically the BugsGridTable class. You will notice that you do not necessarily store the rows to be displayed in the grid, but you can format your data in the GetValue () method. This can be much better, both in terms of memory consumption and because you can change the format of the displayed data on the fly.



Switching to the custom table base class had a big impact on speed, memory consumption, and functionality for the FlameRobin result set dataset grid , an administration tool for Firebird relational database. You can always check its source code as we use wxGrid.

+3


source


Store the value in the row label with SetRowLabelValue and hide the row labels.



0


source







All Articles