Using dropdown listboxes – PB Docs 70

Using dropdown listboxes

Dropdown listboxes are another way to present simple lists
of information to the user. You can present your lists with just
text (in a DropDownListBox) or with text and pictures (in a DropDownPictureListBox).

You add DropDownListBox and DropDownPictureListBox controls
to windows in the same way you add other controls: select DropDownListBox
or DropDownPictureListBox from the Insert>Control menu
and click the window.

Adding items to dropdown listbox controls

In the painter Use the Items property page for the control to add items.

proc.gif To add items to a DropDownListBox or DropDownPictureListBox:

  1. Select the Items tab in the Properties
    view for the control.

  2. Enter the name of the items for the ListBox. For
    a PictureListBox, also enter a picture index number to associate
    the item with a picture.

    For how to add pictures to a DropDownPictureListBox,
    see “Adding pictures to DropDownPicture

In a script Use the AddItem and InsertItem functions to dynamically add items
to a DropDownListBox or DropDownPictureListBox at execution time.

AddItem adds items to the end of the list. However, if the
list is sorted, the item will then be moved to its position in the
sort order. Use InsertItem if you want to specify where in the list
the item will be inserted:

Function You supply
InsertItem Item namePicture index (for a DropDownPictureListBox)Position
in which the item will be inserted
AddItem Item namePicture index (for a DropDownPictureListBox)

This example inserts three items into a DropDownPictureListBox
in the first, second, and third positions:

This example adds three items to a DropDownPictureListBox:

note.gif Using the Sort property You can set the control’s sort property to TRUE to
ensure that the items in the list are always arranged in ascending
sort order.

Adding pictures to DropDownPicture

In the painter Use the Pictures and Items property pages for the control
to add pictures.

proc.gif To add pictures to a DropDownPictureListBox:

  1. Select the Pictures tab in the Properties
    view for the control.

  2. Select an image from the stock image list.


    Use the Browse button to select a bitmap, cursor, or
    icon image.

  3. Select a color from the PictureMaskColor dropdown
    menu for the image.

    The color selected for the picture mask will appear transparent
    in the DropDownPictureListBox.

  4. Select a picture height and width for your image.

    This will control the size of the image in the DropDownPictureListBox.

    note.gif Dynamically changing image size The image size can be changed at execution time by setting
    the PictureHeight and PictureWidth properties before you add any
    pictures when you create a DropDownPictureListBox.

    For more information about PictureHeight and
    PictureWidth, see the PowerScript Reference.

  5. Repeat the procedure for the number of images
    you plan to use in your DropDownPictureListBox.

  6. Select the Items tab and change the Picture Index
    for each item to the appropriate number.

In a script Use the AddPicture function to dynamically add pictures to
a PictureListBox at execution time. For example, this example adds
two BMP files to the PictureListBox:

Deleting pictures from DropDownPicture

For how to delete pictures from DropDownPictureListBox controls,
see “Deleting pictures from picture
listbox controls”

Document get from Powerbuilder help
Thank you for watching.
Was this article helpful?
Notify of
Inline Feedbacks
View all comments
Would love your thoughts, please comment.x