Using drop-down lists – PB Docs 105

Using drop-down lists

Drop-down lists 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 drop-down list 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
    ListBox
    controls”
    .

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

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.

Table 9-2: Using the InsertItem and AddItem functions
Function You supply
InsertItem
  • Item
    name
  • Picture index (for a DropDownPictureListBox)
  • Position in which the item will be inserted
AddItem
  • Item
    name
  • Picture index (for a DropDownPictureListBox)

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

This example adds two 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
ListBox
controls

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, or
    use the Browse button to select a bitmap, cursor, or icon image.

  3. Select a color from the PictureMaskColor drop-down
    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 runtime 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 runtime. For instance, this
example adds two BMP files to the PictureListBox:

Deleting pictures from DropDownPicture
ListBox
controls

For instructions on deleting pictures from DropDownPictureListBox
controls, see “Deleting pictures from picture
list controls”
.


Document get from Powerbuilder help
Thank you for watching.
Was this article helpful?
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x