Browse by category:
|| | ||
Is there a way to get a pointer to a style object instead of a copy? GetStyleRowCol() only gets a copy.
One part of the style object that is displayed in the grid is stored in the CGXData structure. Take a look at CGXData::GetStyleRowCol() to see how to get a pointer to that object. You can implement a method similar to CGXData::GetStyleRowCol() that returns a pointer to a style object.
Objective Grid intentionally does not provide a method that returns a pointer to the style objects that are stored in CGXData. The objects in CGXData don't reflect those attributes you apply to base styles, column and row styles, etc. As you know, ComposeStyleRowCol() loads all base styles at runtime.
If you access the style objects directly, you loose the flexibility to change attributes in the base styles. Also, your CGXGridCore::GetStyleRowCol() override will not have a chance to change the style object before you access it. That's why we decided not to offer direct access to these objects.
Returning a copy of the style object indeed costs more time but this is the cost for the flexibility of Objective Grid. Take formula support for example. Only minor changes were necessary for existing applications and we could provide a nearly 100% source code compatible new version of Objective Grid with formula support.
If you want to give up that flexibility, please do that only in really time-critical operations, e.g. in a loop that is executed many times. For time critical grids, I suggest overriding GetStyleRowCol() and StoreStyleRowCol() to store only those attributes that are really needed in your own data structure object. Then you can easily access these objects directly and you don't have the overhead of storing style attributes (e.g. font, background color) that you don't use in your grid.
|Objective Grid: Caching a virtual grid||Objective Grid: How should I fill the grid with values?|