Display fields from the Contact built-in data component.
Objectives
Discover how to create display fields from the Contact built-in data component, assign screen controls (for example, editBox controls) to the fields of the screen parameter contact of type Contact .
See how to use the Initial Value of each editBox to initialize an editBox control with a field of the contact data component .
Setup Tasks
Open BlackBerry MDS Studio™ and select the Contact Viewer project which you created in the previous lab.
See the lab entitled
Create a Contact Using the Top-Down Approach for more details.
If you have not completed the first lab in this series, create the Contact Viewer project following these steps:
Import the Contact Viewer workspace to BlackBerry MDS Studio
Click File menu -> Import Existing… -> Browse -> select Contact Viewer -> Finish
Tasks
Create the screen with a screen parameter
In the Navigator pane, right-click Screens.
Click New Screen.
In the Name field, type scrDisplayContact.
Click Finish.
In the Screen Editor, click the screen canvas.
In the Properties pane, in the Parameters property, click ....
Click +.
In the Name cell, type contact to replace the default “address”
In the Type drop-down list, click Contact. Note: You can now initialize values of screen controls to the contact screen parameter of the Contact built-in data component.
Click OK.
Create the screen controls with initial values
In the Screen Editor, on the Screen Editor palette, click Region.
Place the region control under the edit box.
In the Properties pane, in the Layout drop-down list, click Grid.
On the Screen Editor palette, click Label.
Place the label control in the region.
In the Properties pane, in the Caption property, click ....
In the Caption field, type First name:.
Click OK.
Create an editBox control to the right of the label control in the region.
In the Properties pane, in the Initial Value property, click ....
In the list of available data, expand Parameters > contact.
Click nameGiven.
Click OK.
Create label and editBox controls for the remaining contact information.
Label caption
EditBox output mapping
Last name:
nameFamily
Email:
Email1
Work:
workTel
Tip: The default layout of the grid region is 2 by 2. To position a label control in the next row of the grid region, drag the control to the far right of the previous row. The BlackBerry MDS Studio positions the control on the next row.
Save the project
In the Navigator pane, click the Contact Viewer project.