Objective Grid: Accessing style objects

Article ID: 205
Last updated: 04 Jun, 2018
Article ID: 205
Last updated: 04 Jun, 2018
Revision: 3
Views: 2236
Posted: 11 Jan, 2001
by Meltreger B.
Updated: 04 Jun, 2018
by Meltreger B.

Problem


Is there a way to get a pointer to a style object instead of a copy? GetStyleRowCol() only gets a copy.
 


Cause



Action


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.
 

This article was:   Helpful | Not helpful
Report an issue
Article ID: 205
Last updated: 04 Jun, 2018
Revision: 3
Views: 2236
Posted: 11 Jan, 2001 by Meltreger B.
Updated: 04 Jun, 2018 by Meltreger B.

Others in this category