Browse by category:
|| | ||
How can I use a grid in a dialog?
The following steps are necessary to embed a grid in a dialog.
- Create or open your dialog template. Choose the user control icon, drag it into the the dialog and open its property page. Enter "GXWND" as class name into the class box and specify the style bits for the grid:
- 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.
- If you created a new dialog, you should now create your dialog class with ClassWizard.
- Embed an object of your derived grid class in the dialog.
|class CDerGridDialog : public Cdialog
|CDerGridDialog(CWnd* pParent = NULL); // standard constructor|
|// Dialog Data|
- Add the OnInitDialog member to your dialog class (WM_INITDIALOG-message). In OnInitDialog, you can initialize the grid:
|BOOL CDerGridDialog::OnInitDialog( )
Note: If you want to use the grid in a formview, you should override OnInitialUpdate instead of OnInitDialog.
- In the dialog's DoDataExchange method add:
|Objective Grid: Maintaining the cursor position as a cell loses...||How can I read data from a text file in tab-delimited format?|