Chapter 15: Fundamental Controls Visual C++ and MFC Fundamentals
- Click the arrow of the Category combo box and select Value
In the Variable Type combo box, if necessary, select CString
In the Variable Name edit box, type m_szCircleRadius - Click Finish
- In the same way, Add a CString Value Variable for each edit box. From top to
bottom, name them m_szCircleCircumference, m_szCircleArea,
m_szEllipseradius, m_szEllipseRadius, m_szEllipseCircumference, and
m_szEllipseArea respectively - Open the Circular.h header file and check the new value variable
- Also open the Circular.cpp source file and check the content of the
DoDataExchange() event.
14.1.5..Controls Event Handlers....................................................................
As we reviewed when introduced messages, an event is an action resulting from a
generated message. As there are various types of controls, there are also different types of
messages available on controls and even the type of window considered. After adding a
control to your application, whether you visually added it or created it dynamically, you
will also decide how the handle the possible actions that the user can perform on the
control.
There are various ways you can write an event for a message. If the message is sent from
a class, first select the class in Class View. Then, in the Properties window, click either
the Events , the Messages , or the Overrides button, depending on the type
of member function you want to write.
Some of the most regular actions the user can perform on a control is to click it. Object
that receive click messages range from static controls to command buttons, as we will see
eventually. To generate code for a control that is positioned on a dialog-based object,
display its parent window. Then, right-click the control and, on the context menu, click
Add Event Handler. This would display the Event Handler Wizard with as much
information as you need to set or select to configure the event. Once you have finish
specifying the necessary items for the event, click Add And Edit. This would take you to
the new event in the Code Editor where you can write the rest of the code for the event. If
you use the wizard to generate the event, the necessary arguments and part of the code for