Displaying Media Images

Both the BasicLitCrit and EnhancedLitCrit Outlook forms display an image that corresponds to the currently selected media type. This image changes as you use option buttons to change to a different media type. Both the BasicLitCrit and EnhancedLitCrit forms control this functionality in the same way, using three types of controls and script. These are the controls used:

Image Control

The Image control at the upper-left corner of the page displays the image. Its functionality is similar to the LoadPicture function of Microsoft Visual Basic. It loads and displays one of the four images stored within the form in the ImageList control.

The name of this Image control on the form is imgMedia; this name will be used in the form's script.

ImageList Control

After the ImageList control was placed on the form, four images were stored within it, using the Images tab of its Properties page. (Note that when you right-click the control, a menu displays the choice of two Properties pages; to show the page for adding images, click the word Properties at the bottom of the list.) Each image was assigned a key, which is a string used in the form's script code to reference the image. These key values are "Book," "Prd," "AV," and "Soft."

The fact that the ImageList control stores the .gif files to be displayed also means that they are stored within the form. This simplifies their display at run time because they are readily located, within the current page of the same form. It simplifies the application's deployment because they need not be copied as individual graphics files onto client computers. However, their presence in the form increases its size.

The name of this ImageList control on the form is ImageList1; this name will be used in the form's script.

Option Buttons

The BasicLitCrit and EnhancedLitCrit forms use four option buttons that represent the media types. These option buttons exist only on the compose versions of the form's pages. Although the read versions also show the media graphic, the form's design prohibits changing the media type (and everything else) on read-only pages, so the option buttons are not present.

Each option button is bound to a field called Media, which holds a string. This string can have one of four values, "Book," "Periodical," "Audio/Video," or "Software." Because all four buttons are bound to the same field, they act as a group, which means that only one can be selected at a time. The string content of the Media field is used in script to display the correct graphic, as identified by its Key value.

The Form's Script

In the following code, the value of the Media field is checked to determine which option button was clicked. In a Case statement, the appropriate image is displayed when the image, identified by its Key value (such as "AV") is assigned to the Picture property of the imgMedia ImageList control. (Setting the Picture property in an ImageList control automatically displays the image assigned to that property.)

'Choose the default option of radio button to load image
Select Case Item.UserProperties("Media").Value 
   Case "Book": 
      Set MyPage.imgMedia.Picture = MyPage.ImageList1.ListImages("Book").Picture
   Case "Audio/Video":
    Set MyPage.imgMedia.Picture = MyPage.ImageList1.ListImages("AV").Picture
   Case "Periodicals"
    Set MyPage.imgMedia.Picture = MyPage.ImageList1.ListImages("Prd").Picture
   Case "Software"
    Set MyPage.imgMedia.Picture = MyPage.ImageList1.ListImages("Soft").Picture
   End Select