Tutorial 8
Grouping of GUI Elements
GOAL: Group sections of GUI elements as an advantage of organizing the user interface
PREREQUISITES: Tutorial 1 with the '
MFC Library1'
library added as a dependant and included 'MFC_Library1.h' at the bottom of 'stdafx.h'
- Drag a Static Text to the dialog window,
inside the Properties window, change
- to "IDC_PLACEHOLDER"
- to "Placeholder for control group"
- to
- to
- Inside the Resource View,
the Dialog folder and Click
- With the new resource window selected, inside the Properties window, change
- to "IDD_CONTROLS_CHILDDLG"
- to
- to
- to
- to
Figure 8.1 - Placeholder
Connecting Class to Resource
- Inside the Solution Explorer,
the Project (MFC_GroupControls) folder and Click
- Inside the Add Class window, select
- Categories to
- Template to
Figure 8.2 - Add Class
- Inside the Generic C++ Class Wizard window, change
- Class Name to "CCircleRadiusControls"
- .h file and .cpp file will be inserted automatically
- Base Class to
- Access to
Figure 8.3 - Generic C++ Class Wizard
- In 'TutorialDlg.h', add
- #include "CCircleRadiusControls.h" to the top
- CCircleRadiusControls m_circle_controls; as a private variable
- Inside 'Tutorial.cpp', inside OnInitDialog() function, add
...
ReplaceDialogControl(*this, IDC_PLACEHOLDER, m_circle_controls, IDD_CONTROLS_CHILDDLG);
...
ReplaceDialogControl(...) found in 'UtilityFunctions.cpp' as part of the MFC Library 1
- In the Visual Studio project window, click
- >>
- >> to run
Figure 8.4 - Application Window
» Written by
William Frankhouser (
wjf2@washington.edu)
» Advised by
Kelvin Sung (
ksung@washington.edu)
as part of the project sponsored by the National Science Foundation under Grant No. 0442420. Any opinions, findings, and conclusions or recommendations expressed in this
material are those of the author(s) and do not necessarily reflect the views of the National Science Foundation.
» Produced in the "Essential Concepts for Building Interactive Computer Graphics Applications", A.K. Peters, Ltd.