BlackBerry
Skip Top Navigation
Developers Partners
North America [change region] Products Solutions Purchasing Support
Developers


Display Contact Information

Exercise

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:

  1. Download the Contact Viewer workspace (ZIP) and unzip the file.
  2. 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

  1. In the Navigator pane, right-click Screens.
  2. Click New Screen.
  3. In the Name field, type scrDisplayContact.
  4. Click Finish.
  5. In the Screen Editor, click the screen canvas.
  6. In the Properties pane, in the Parameters property, click ....
  7. Click +.
  8. In the Name cell, type contact to replace the default “address”
  9. 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.
  10. Click OK.

Create the screen controls with initial values

  1. In the Screen Editor, on the Screen Editor palette, click Region.
  2. Place the region control under the edit box.
  3. In the Properties pane, in the Layout drop-down list, click Grid.
  4. On the Screen Editor palette, click Label.
  5. Place the label control in the region.
  6. In the Properties pane, in the Caption property, click ....
  7. In the Caption field, type First name:.
  8. Click OK.
  9. Create an editBox control to the right of the label control in the region.
  10. In the Properties pane, in the Initial Value property, click ....
  11. In the list of available data, expand Parameters > contact.
  12. Click nameGiven.
  13. Click OK.
  14. 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

  1. In the Navigator pane, click the Contact Viewer project.
  2. On the toolbar, click Save.

Additional Labs

Go to the next exercise in “Creating a Length Conversion Application Using the Top-down Approach”, Receive a subset of contacts on a BlackBerry® device.

Back to the Developer Lab Main Menu

 
Other Resources
 
     
 Home | Products | Solutions | Purchasing | Support | Developers | Worldwide | News | About Us | Contact Us | Site Map
 Legal | Copyright © 2008 Research In Motion Limited, unless otherwise noted.