USING AN EDIT BOX CONTROL
An edit box control is for managing text entry to an application. You will use an edit box control to add annotations to a sketch in Sketcher. You’ll need a new Sketcher element type, CText, that encapsulates a text string, and a menu item to set TEXT mode for creating elements. Because a text element needs only one reference point, you can create it in the OnLButtonDown() handler in the view class. You’ll also need a new item in the Element menu to set TEXT mode. You’ll add this text capability to Sketcher in the following sequence:
Creating an Edit Box Resource
Create a new dialog resource in Resource View by right-clicking the Dialog folder and selecting Insert Dialog. Change the ID for the new dialog to IDD_TEXT_DLG, and the Caption property value for the dialog to Enter Text.
To add an edit box, select the Edit Control icon in the Toolbox pane and click the position in the dialog where you want to place it. You can adjust the size of the edit control by dragging its borders, and you can alter its position in the dialog by dragging the whole thing around. You can display the properties for the edit box by right-clicking it and selecting Properties from the pop-up. You could first change its ID to IDC_EDIT_TEXT, as shown in ...
Get Ivor Horton's Beginning Visual C++ 2012 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.