<< Return to Main Index

< Return to Class Index

class CGXBrowserLayoutManager template <class GRID>

Remarks

GRID Specifies the grid class it will be bound to.

The layout manager, CGXBrowserLayoutManager, is a utility class for the database engine grid that encapsulates the logic involved in initializing the grid with a browser-like layout and enabling a browser-like editing behavior (MS Query like). In the browser-like editing behavior we start an edit mode when the user starts editing a record, cache the changes made in the record in a temporary buffer and store the changes into the data source when the user moves to a new record.

It also communicates with the DBEngine to fetch and store data, for and from the grid. With this utility class the programmer can now easily customize the browser-like layout and the browser-like editing behavior by subclassing and overriding the appropriate virtuals.

This class will be instantiated inside the CGXDBEGrid with GRID being a CGXGridView or CGXGridWnd or one of their derivatives.

To customize the layout manager subclass CGXBrowserLayoutManager and override the appropriate virtuals, then override CreateLayoutManager in the CGXDBEGrid derived class and do something like this:

// Custom layout manager.
class CMyBrowserLayoutManager : public CGXBrowserLayoutManager <CGXGridView>
{
// Some overrides for customization…
public:
   CMyBrowserLayoutManager(CMyDBEGridView * pDBEGrid, CGXDBEngine* pEngine);
   virtual ROWCOL GetLastRow();
};

// Hook in your derived layout manager into the grid
void CMyDBEGridView::CreateLayoutManager(CGXDBEngine* pEngine)
{
   if(m_pLayoutManager)
      delete m_pLayoutManager;
   m_pLayoutManager = new CMyBrowserLayoutManager(this, pEngine);
}

Since CGXBrowserLayoutManager is a utility class for CGXDBEGrid, the functions defined are same as that of the CGXDBEGrid. Please take a look at CGXDBEGrid for information regarding an API.

See Also

CGXDBEngine CGXDBEGrid

CGXBrowserLayoutManager

Class Members