Basic VBScript for Elipse E3: Lesson 6 – ComboBox and ListBox

ComboBox


Figure 11

The ComboBox object displays/hides a list of items configured by the user. To fill the list we use OnStartRunning event.

Example:

Sub ComboBox1_OnStartRunning()
    ‘Fill ComboBox
    Clear()
    AddItem “January”
    AddItem “February”
    AddItem “March”
End Sub

Exercises:

1. Create a ComboBox on screen and fill it with all the days of the week.
2. Insert a DataBase object in the project and configure it.
3. Create 3 internal tags named: red, green and blue.
4. Insert a Formula object that keeps a color’s amount of red, green and blue. Use the internal tags to load and save the values of the formula. Register at least 4 colors.
5. Fill in the ComboBox with all the registered colors. (Use GetFormulaValueDataObj method from the Viewer)
6. Create a new button on screen to input a new value in the formula. Write the name of the new color in an InputBox. The input value must appear in the ComboBox.
7. Create a button to remove the selected color from the formula’s ComboBox. Only the erased color must be removed from the ComboBox.

ListBox


Figure 12

A ListBox object is similar to a ComboBox, and displays a list of items configured by the user. To fill this list we use OnStartRunning Event.

Example:

Sub ListBox1_OnStartRunning()
    ‘Fill ListBox
    Clear()
    AddItem “Monday”
    AddItem “Tuesday”
    AddItem “Wednesday”
End Sub

Exercises:

1. Create a ListBox on screen e fill it with all the days of the week.
2. Display on a message box the name of the selected day.


Anexos:

Lesson6.zip

Print Friendly, PDF & Email

Este artigo foi útil? Was this helpful?

Classificação média - Average rating 0 / 5. Count: 0

Leave a Reply

Your email address will not be published.Required fields are marked *