Objective Grid: Grid types

Article ID: 430
Last updated: 27 Apr, 2018
Article ID: 430
Last updated: 27 Apr, 2018
Revision: 3
Views: 1831
Posted: 12 Jan, 2001
by Meltreger B.
Updated: 27 Apr, 2018
by Meltreger B.

Problem

 


What are the different grid types provided by Objective Grid. Do you have any guidelines when I should use a browser grid, a regular grid or a grid with formulas?

 

 


Cause

 


 

 


Action

 


Objective Grid mainly differentiates between four types of grids:


Objective Grid provides implementations of Browser Grid for ODBC and ADO. Furthermore, you can easily add your own implementation of Browser Grid for any other record-based data source. For example, you could write your own Browser Grid implementation for SQL Server API, Sybase SQL Server, DBTools from RogueWave or CodeBase from Sequiter.

  1. Regular Grid - You fill the grid with data at startup, the user has the ability to edit cells and changes will be stored in the grid.
  2. Virtual Grid - The data to be displayed in the grid are maintained in a self-written data structure or in an external file. The grid does not hold any cells in memory. You don't fill the grid at startup. Instead, you override the GetStyleRowCol() function to supply data on demand. Objective Grid calls GetStyleRowCol() only for the currently visible cells before it draws the cells on the screen. If you want the user to be able to edit cells, you need to override StoreStyleRowCol() and store the changes back into your custom data source. Objective Grid calls StoreStyleRowCol() whenever a cell is changed.
  3. Formula Grid (not available in Objective Grid Lite) - You enable the formula engine at startup. You fill the grid with data at startup. Cells can have formulas that reference other cells. The user has the ability to edit cells and changes will be stored in the formula engine. If a cell that is referenced by a formula is changed, the depending cell is automatically updated.
  4. Browser Grid (not available in Objective Grid Lite) - Browser Grid is somewhat similar to Virtual Grid. The main difference is that Browser Grid has been designed with certain characteristics of record-based data sources in mind. Take an ODBC recordset for example. You cannot directly access data in any record. You have to loop through the records in order to go to the wanted record. Then you can read data from this current record and change them. When the user starts editing a record, changes should only be written back to the recordset when the user navigates to a new record. Therefore Objective Grid holds changes in the current record in a buffer and flushes this buffer only when the user moves to a new record. Browser Grid also lets the user easily append rows. The appearance of Browser Grid is very similar to MS Access query views.

Here are some guidelines that should help you decide what kind of grid you want to use:

  1. Do you need formula support?

  2. Then you should use the Formula Grid. Check out the formula sample for using formulas. You have to fill the grid with data at startup.
     
  3. Do you maintain data in an external data source or custom data structure?

  4. There are more issues to consider:
    1. Do you want to browse an ODBC or ADO recordset?

    2. Then you should use the ODBC or ADO Browser Grid implementation. Check out the gxquery and adoquery samples for using this type of grid.
       
    3. Is the external data source record based? I mean should changes in a cell be immediately written back to the data source or should they be held in a buffer and flushed only when the user navigates to another record?

    4. Then you should derive from Browser Grid. Take a look at the dbfbrowse sample. This sample demonstrates how to derive from CGXBrowserGrid and lets you browse dbase files.
       
    5. Do you want the grid to directly operate on your data?

    6. Use Virtual Grid. This has the advantage that you don't have to copy all the data at startup into the grid. The gridapp sample provides a sample for this type of grid. Check out the files browsevw.cpp and browsevw.h.
       
    7. Do you want to copy the data into your grid?

    8. Use Regular Grid. At startup you fill the grid with your data. The 1stgrid tutorial demonstrates this kind of grid.

This article was:   Helpful | Not helpful
Report an issue
Article ID: 430
Last updated: 27 Apr, 2018
Revision: 3
Views: 1831
Posted: 12 Jan, 2001 by Meltreger B.
Updated: 27 Apr, 2018 by Meltreger B.

Others in this category