Previous Topic: Property SheetNext Topic: Add Spin Controls


Define a Multiline Edit Control

You can modify the panel displayed by Project.Edit so that it displays multiple lines of text and does not extend past the edge of the dialog.

To modify Project.Edit.Panel and to define a multiline edit control

  1. Arrange the Panel Designer windows so they do not overlap and you can work with the contents of each.

    You must select an element on a panel to make a change to it. To select only the element, and not the region it is in, use the Panel Palette.

  2. Expand Panel to display the regions on the Edit panel if it is not already expanded.
  3. Expand the DetailP region and expand the Project Description field.

    Define a Multiline Edit Control

  4. Select the Edit control.

    The values in the Property Sheet indicate the properties you can change for the edit box. Also, notice in the Design Window that only the edit box next to the label Project Description is selected.

  5. In the Design Window, drag the edit control below the label so that its left edge lines up more or less with the j in the word Project. Do not be concerned that it covers up the Project Start Date field—this is fixed later.

    In the Property Sheet, the Position (Col, Row) property will change as a result of moving the element. If you want to make fine tuning changes, you can specify the exact pixel location in the Property Sheet.

    The field still extends past the right edge of the panel.

  6. In the Property Sheet, click the Size (Col, Row) property.
  7. In the edit area at the top of the Property Sheet, change the value to 200, 20, and click the check mark button.

    The edit control resizes so that it fits within the panel and the beveled box that surrounds the fields resizes so that it is just slightly wider than the fields.

    Define a Multiline Edit Control (2)

  8. Drag the handle on the bottom center of the edit box to make the box taller. Make it about three times as tall.

    The panel should look something like this:

    Define a Multiline Edit Control (3)

    You have repositioned and resized the Project Description edit box. Next, set two properties that enable end users to enter more than one line of text in the edit box.

  9. In the Property Sheet, double‑click the Multi-line property to change its value from No to Yes.
  10. Select the Scrolling property in the Property Sheet.

    Note: If the Scrolling property is not available, ensure that the value of the Multi-line property changed from No to Yes.

    Notice that the input area at the top of the Property Sheet is changed so you can select a value from a list, but you cannot type in a value.

  11. Select Vertical from the list.

    Setting the Scrolling property to Vertical causes the text in the multi-line edit box to wrap to the next line when the cursor reaches the right edge. If you do not set this option, text continues on the first line and extends beyond the edge of the field, rather than wrapping to the next line.

    When you change the size and shape of the Project Description edit box, it covers the Project Start Date and the Project End date fields. Next, move those two fields down.

  12. In the Panel Palette, select the Project Start Date field in the DetailP region without expanding it.

    Define a Multiline Edit Control (4)

  13. Holding the Ctrl key down, select the Project End Date field. This selects the Project Start Date and the Project End date fields.
  14. Drag the fields in the Design Window so they are below the bottom of the Project Description multiline edit box.

    You can see that the beveled box around the fields resizes to fit around all of the fields:

    Define a Multiline Edit Control (5)