beautypg.com

Adding dynamic elements to table cells, Binding the dynamic elements in the table, Adding dynamic elements to table cells 45 – Apple WebObjects 3.5 User Manual

Page 45: Binding the dynamic elements in the table 45

background image

Creating a Custom Guest Class

45

11. Click in the component window, then press Tab.

Pressing Tab when editing a table causes the contents of the next cell
to the right to be selected (or the first cell of the next row if in the
rightmost column). Pressing Shift-Tab moves in the opposite direction
through the table.

12. Repeat steps 7 through 11 for the second and third cells of the top row.

Label the middle column

E-mail

and set its width to 150 pixels. Label

the third column

Comments

and leave its width unset. (The comments

field takes up the remainder of the width of the table.)

Note:

It isn’t necessary to adjust the height of the columns, since they

expand at run time to accommodate the size of the text being
displayed.

Adding Dynamic Elements to Table Cells

Tables and cells are static HTML elements, so you can’t bind them to
variables or methods. To display dynamic information in cells, you add
dynamic elements, such as WOStrings, to the cells.

1. Select the contents of the first cell in the second row of the table by

clicking in the cell, then double-clicking the text.

2. Choose

from the Elements pop-up list.

3. Click

to add a WOString to the cell.

4. Press the Tab key.

The contents of the next cell to the right are selected.

5. Repeat steps 3 and 4 for the other two cells in the second row.

Binding the Dynamic Elements in the Table

1. Select

currentGuest.guestName

in the object browser and drag the cursor to

the center of the WOString in the first column to bind its

value

attribute.

2. Similarly, bind

currentGuest.email

and

currentGuest.comments

to the second and

third WOStrings.