Hello all,
I need a component like TStringGrid or TDrawGrid to display boolean data. I.e. each cell should display a rectangle or circle when the value is true and stay blank for false.
-> What component would be suitable for that and how to manage the data?
A StringGrid with overridden Paint method would be possible and the data could be written in the strings as ascii, e.g. as '0' and '1'. But I don't like the way of storing the data.
An other possibility would be to use a DrawGrid and implement a data structure for the boolean values or pass a reference to a data structure. An internal data structure would make the component more self contained, but would result either in a double storage of the data, once in the grid and once in the programm logic. Or it would make the programm logic too much bound to the Grid, if the grid internal data structure is used in the complete program.
The data structure could be passed to the grid as pointer or reference, but the the grid would become quite specific and this somehow results in decentral access to the data structure.
About the data structure itself, using an "array of array of Boolean" would be easy, but the dimension changes often, so this would afaik result in a lot of internal copying when the array bounds are increased. Also reading and writing data I think would result in a lot of copying and a class based data structure could be better, then only the references need to be passed.
-> How would You do that, what is a good way to have clean code and reduce entanglement?
In the application the grid will be the editor for manipulating the data, so there will be marking, moving, inserting etc.
Thanks in advance.
Regards~