class CGXBrowserGrid: public CGXGridCore
The CGXBrowserGrid encapsulates the browsing functionality used by the CGXDaoGrid and the CGXODBCGrid classes. By encapsulating all the functionality necessary for browsing external data sources, you as programmer can benefit from the Objective Grid browsing capabilities and derive your own class from CGXBrowserGrid. This makes it possible for you to create MS-Query-like browsers for self-written databases or other database toolkits.
The CGXBrowserGrid class maintains one current record with the current cell. When the user edits data in the current record, all changes are stored in an internal buffer. When the user moves the current cell to another record, changes for the current record are written to the data source before the current cell is positioned to a new record. When the user clicks on the last row, a new record will be added to the data source (if it supports appending records).
The DbfBrows sample provides a sample for deriving a view from CGXBrowserGrid and lets the user browse Dbase files.
The main features of CGXBrowserGrid are:
-
Row headers show the state of the current record: an arrow marks the current record as unmodified; a pencil indicates that the current record has been modified.
-
Provides support for adding rows to the data source. When the user enters data in the last row (marked with an asterisk in the row header), a new record will be appended.
-
The user can undo changes or cancel all pending changes in the current record.
-
Provides improved abstraction for loading cell data from data source and storing all changed cells data into the data source when the user has moved to a new record.
-
Lets the programmer validate user input at record level. This means that the user can input data into the record, and when he wants to move to a new record, all changes for the previous record will be validated.
-
When the user opens several views on the same data, current cell changes and movements will be synchronized among the views.
-
Provides support for rearranging columns and rows. This lets you add support for dragging columns and sorting rows.
- Provides support for maintaining a high-water mark for the last seen record. CGXDaoGrid and CGXODBCGrid use this high-water mark so that the record count can be determined while the user loops through the records.
CGXBrowserGrid is not derived from CWnd. The CGXBrowserView class represents the GXBrowserGrid as view. The CGXBrowserWnd class represents the GXBrowserGrid as control.
CGXBrowseParam holds specific data for the CGXBrowserGrid. It can be shared among several views (works the same way as CGXGridParam). You can embed it in a document if you want to support several browse views on the same data, as for example in a dynamic splitter window. The DbfBrows sample shows you how to embed the CGXBrowseParam into the document and how to add support for serializing the scheme information of the grid.
Take a look at CGXBrowseParam. It describes some internal attributes that let you adapt the CGXBrowserGrid to your specific needs. Also, cut and paste behavior can be customized through CGXBrowseParam attributes.
#include <gxall.h>
See Also
CGXBrowseParam CGXBrowserView CGXBrowserWnd CGXDaoGrid CGXODBCGrid