How to use expandable edit control in dialog?
By Alexander Shargin, April 10, 2002.
Question
How can I insert an expandable edit control in my dialog?
Answer
An expandable edit control is an edit control that shows only one line. It
is expanded to full screen when a user presses the Action key or the right
or left navigational key. Figure below shows an expandable edit box in normal
and expanded state.
To insert expandable edit control to dialog box template follow these steps.
- Open dialog template in EVC resource editor.
- Insert an ordinary edit box to dialog. Open properties window and check
'Multyline' checkbox for edit box.
- Insert spin control to dialog. Open properties window. Set 'Right' in
'Align' combo box and check 'Auto buddy' checkbox for spin control.
- Make sure that the spin control immediately follows the edit box in
z-order. To view or change z-order of the controls use Layout->Tab order
command (or press Ctrl+D).
- To complete the process you must assign UDS_EXPANDABLE and UDS_NOSCROLL
styles to the spin control. Alas EVC resource editor does not support them.
To insert them manually open your application's rc-file in text mode and add
"UDS_EXPANDABLE|UDS_NOSCROLL" to the list of spin control's styles. Also set
a name for spin control. Note that this name will be displayed in the title
bar when edit box is expanded. Your rc-file will look like this:
EDITTEXT IDC_EDIT1,16,30,40,14,ES_MULTILINE | ES_AUTOHSCROLL
CONTROL "Edit description",IDC_SPIN1,"msctls_updown32",UDS_ALIGNRIGHT |
UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_EXPANDABLE|UDS_NOSCROLL,97,61,10,14
That's all. Show the dialog and it will contain expandable edit box.
Discuss
Discuss this QA.
Here you can write your comments and read comments of other developers.
|