Direct editing of text is supported for any text field in a container, including the container title, column headings, and container items. If a text field, such as the text field beneath an icon in the Icon view, has no text and is not read-only, a user can place text in that field by editing the field directly. The font specified for the container by the application is used for the edited text.

Direct editing is supported only for text data. Therefore, if the data type in the Details view is other than CFA_STRING, a user cannot edit it. CFA_STRING is an attribute of the FIELDINFO data structure's flData field.

You can prevent a user from editing any of the text in a container window by setting the CCS_READONLY style bit when a container is created. If you do not set this style bit, the user can edit any of the text in a container window unless you set the following read-only attributes:

If one of these read-only attributes is set, a user's attempts to edit container text directly are ignored.

A user can edit container text directly by doing either of the following:

The container control responds by using the WM_CONTROL message to send the CN_BEGINEDIT notification code to the application. A window that contains a multiple-line entry (MLE) field opens to show that container text can be edited directly.

The editing actions supported by MLEs, such as Cut, Copy, and Paste, are also supported by the container control. These actions can be performed using system-defined shortcut keys. The actions and shortcut keys are defined by CUA interface design guidelines.

If the user enters a text string that is longer than the text field, the text string scrolls. If multiple lines of text are needed or wanted, a user can press the Enter key to insert a new line.

A user can end the direct editing of container text and save the changes by doing either of the following:

The container responds by sending the WM_CONTROL message to the application again, but this time with the CN_REALLOCPSZ notification code. The application can allocate more memory on receipt of the CN_REALLOCPSZ notification code, if necessary. If the application returns TRUE, the container control copies the new text to the application's text string. If the application returns FALSE, the text change in the MLE is disregarded. The container then sends the WM_CONTROL message to the application again, this time with the CN_ENDEDIT notification code. The MLE field is removed from the screen, leaving only the text string.

A user can end the direct editing of container text without saving any changes to the text in numerous ways, including the following:

The CN_ENDEDIT notification code is sent to the application in each of these cases.


[Back] [Next]