<< Return to Main Index

< Return to Class Index

class CGXRecordInfoWnd: public CWnd

The CGXRecordInfoWnd class displays a record status beam (similar to Microsoft Access or Microsoft Query) in the scrollbar.

It displays the current record in an edit field and displays some navigation buttons. The end user can click on the navigation buttons to scroll through the recordset or can directly enter a record number in the edit field.

CGXRecordInfoWnd can be used either in a document frame window (CFrameWnd) or in a dialog template.

CGXRecordInfoWnd is mainly based on the code of the CSplitterWnd class. Using a CGXRecordInfoWnd in a frame window is similar to using a splitter window in a frame window.

Steps necessary for using CGXRecordInfoWnd:

a) Using a CGXRecordInfoWnd in a document frame window

If you want to use the CGXRecordInfoWnd in an MDI frame window, you must derive a class from CMDIChildWnd. In the derived class, you should add a CGXRecordInfoWnd object and override OnCreateClient where you should call the Create method for CGXRecordInfoWnd.

//////////////////////////////////////////////////////////////////////
// CODBCSampleRecordWnd frame window

class CODBCSampleRecordWnd : public CMDIChildWnd
{
   GRID_DECLARE_DYNCREATE(CODBCSampleRecordWnd)
protected:
   CODBCSampleRecordWnd();           // protected constructor used by dynamic creation

// Attributes
protected:
   // embedded CGXRecordInfoWnd object
   CGXRecordInfoWnd   m_wndRecordInfo;
public:

// Operations
public:

// Overrides
   //{{AFX_VIRTUAL(CODBCSampleRecordWnd)
   protected:
   virtual BOOL OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext);
   //}}AFX_VIRTUAL

// Implementation
public:
   virtual ~CODBCSampleRecordWnd();

   // Generated message map functions
   //{{AFX_MSG(CODBCSampleRecordWnd)
   //}}AFX_MSG
   GRID_DECLARE_MESSAGE_MAP()
};

//////////////////////////////////////////////////////////////////////
// CODBCSampleRecordWnd

IMPLEMENT_DYNCREATE(CODBCSampleRecordWnd, CMDIChildWnd)

CODBCSampleRecordWnd::CODBCSampleRecordWnd()
{
}

CODBCSampleRecordWnd::~CODBCSampleRecordWnd()
{
}

BOOL CODBCSampleRecordWnd::OnCreateClient(LPCREATESTRUCT /*lpcs*/, CCreateContext* pContext)
{
   return m_wndRecordInfo.Create(this, pContext);
}


BEGIN_MESSAGE_MAP(CODBCSampleRecordWnd, CMDIChildWnd)
   //{{AFX_MSG_MAP(CODBCSampleRecordWnd)
   //}}AFX_MSG_MAP
END_MESSAGE_MAP()

b) Using a CGXRecordInfoWnd in a dialog with SubclassDlgItem

1.Create or open your dialog template. Choose the user control icon, drag it into the dialog and open its property page. Enter "GXWND" as class name into the class box and specify the style bits for the recordwnd:
- 0x50b10000 to display both scrollbars and a border
- 0x50810000 to display no scrollbars but a border
See the definitions for windows style bits in your windows.h header file.

2.If you created a new dialog, you should now create your dialog class with ClassWizard and override the OnInitDialog method (WM_INITDIALOG message).

3.Embed an CGXRecordInfoWnd and a CGXGridWnd-derived object in the dialog:

// CODBCSampleDialog dialog

class CODBCSampleDialog : public CDialog
{
// Construction
public:
   CODBCSampleDialog(CWnd* pParent = NULL);   // standard constructor

// Dialog Data
   //{{AFX_DATA(CODBCSampleDialog)
   enum { IDD = IDD_DLGSAMP6 };
      // NOTE: the ClassWizard will add data members here
   //}}AFX_DATA

   CODBCSampleGridWnd m_wndGrid;   // CGXGridWnd-derived object
   CGXRecordInfoWnd m_infoWnd;

// Overrides
   // ClassWizard generated virtual function overrides
   //{{AFX_VIRTUAL(CODBCSampleDialog)
   protected:
   virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
   //}}AFX_VIRTUAL

// Implementation
protected:
   // Generated message map functions
   //{{AFX_MSG(CODBCSampleDialog)
   virtual BOOL OnInitDialog();
   //}}AFX_MSG
   GRID_DECLARE_MESSAGE_MAP()
};

////////////////////////////////////////////////////////////////////

4. In your OnInitDialog member you should initialize the grid and the CGXRecordInfoWnd:

BOOL CODBCSampleDialog::OnInitDialog()
{
   CDialog::OnInitDialog();

   m_infoWnd.SubclassDlgItem(IDC_ODBCSAMPLEGRID, this);
   m_wndGrid.Create(0, CRect(0,0,1,1), &m_infoWnd, IDC_ODBCSAMPLEGRID);
   m_infoWnd.AttachWnd(&m_wndGrid);
   m_wndGrid.Initialize();
   m_wndGrid.SetFocus();

   return TRUE;  // return TRUE unless you set the focus to a control
                 // EXCEPTION: OCX Property Pages should return FALSE
}

#include <gxall.h>

See Also

CGXRecordInfoBeam

CGXRecordInfoWnd

Class Members