Controlling a Field's Width

Description

Default Behavior, Using "Nowrap", and Using a TextBox.

Default Behavior

If you want to prevent the wrapping of the field data, one option is to use the "nowrap" command. In the following picture it prevents the phone field from wrapping to 2 lines, even as the page becomes too narrow to show the whole grid.

  1. Create a new tabular grid based on the AlphaSports customer table.

  2. Display the Component Type menu of the Grid Component Builder.

  3. Select the Grid is Read only radio button.

  4. Display the Grid > Properties menu.

  5. Change the Layout Options > Rows of data to 2.

  6. Display the Grid > Fields menu.

  7. Move the "Firstname", "Lastname", "Company", and "Phone" fields from the Available Fields list to the Selected Fields list.

  8. Click Browser to see what the component will look like.

By default the Grid Builder uses label controls to display the field values.

images/WPT_Field_Width_1.gif

The company and phone fields wrap as the page becomes more narrow.

images/WPT_Field_Width_2.gif

Using "Nowrap"

  1. Select the "phone" field in the Selected Fields list.

  2. Click the '...' in the Label Properties > In-line Style field.

  3. In the resulting Style Editor display the Text tab.

  4. Set the Wrapping field to "nowrap".

  5. Click Browser to see what the component will look like.

    images/WPT_Field_Width_3.gif

Using a TextBox

Another strategy is to prevent wrapping is to change the control to a "TextBox" (note the black border in the picture below), which can have a specified width. In the picture below you can see that the company field will not narrow as the page becomes narrower.

  1. Display the Grid > Fields menu.

  2. Select the "company" field in the Selected Fields list.

  3. In the Display Settings > Control type field select "TextBox".

  4. In the TextBox Properties > Size field set the desired width in characters.

  5. Click Browser to see what the component will look like.

    images/WPT_Field_Width_4.gif
    If you want the TextBox to appear the same as a Label, you can change its in-line style.
  6. Display the Grid > Fields menu.

  7. Select the "company" field in the Selected Fields list.

  8. Click the '...' in the TextBox Properties > In-line style to display the Style Editor.

  9. Display the Edges tab.

  10. Set the Border Edge field to "All".

  11. Set the Style field to "All".

  12. Set the Width field to 0.

  13. Click OK. The resulting HTML code is " border-style: solid; border-width: 0; ".

  14. Click Browser to see what the component will look like.

    images/WPT_Field_Width_5.gif