Chapter 16: Text-Based Controls Visual C++ and MFC Fundamentals
Practical Learning: Using Static Labels
- From the Dialog folder of the Resource View, double-click the
IDD_CLARKSVILLEICESCREAM1_FORM form to display it - On the Controls toolbox, click Static Text and click on the form.
- On the Properties window, click Caption and type &Date Hired:
- Using the Static Text control, complete the form as follows:
- Test the application and return to MSVC
16.2 Edit Controls................................................................................................
16.2.1 Introduction
An edit box is a Windows control used to display text or get it from the user. To provide
its functionality, the control displays a box, whose background is white by default,
surrounded by a black line. If the box is empty, the user may be expected to enter some
letters, numbers, or other characters into it. If the box contains some text, the user should
be able to edit it. Another edit box may be used to present text to the user without his or
her being able to change it. The text that displays in an edit box is referred to as its value.
Like most other controls, the role of an edit box is not obvious at first glance. That is why
it should (always) be accompanied by a label that defines its purpose. From the user’s
standpoint, an edit box is named after the label closest to it. Such a label is usually
positioned to the left or the top side of the edit box. From the programmer’s point of
view, an edit box is a place holder used for various things. For example, you can show or
hide it as you see fit.
To create an edit box, click the Edit Box button from the Controls toolbox and click the
desired area on a form or a dialog box.