Working with List Boxes, Combo Boxes, Radio Buttons Etc.

Description

If a list box, drop-down list box, radio button, two-state, or multi-state button control has a user defined list of choices, you can modify the displayed choices with Xbasic. For example, a drop-down list box might offer these choices to the user:

  • Cash

  • MasterCard

  • Visa

Using Xbasic, you might want to dynamically add additional items to this list, or remove items from the list. For example, assume you that you have a form called Invoices with a control called Payment that is a drop-down list box. To add the item "Net 30 days" at the end of this list box, you could use the following Xbasic commands:

:Invoices:Payment.choice.list.insert()
:Invoices:Payment.choice.list[4].text = "Net 30 days"
:Invoices:Payment.choice.list[4].value = "Net 30 days"
In this example, the text (which appears in the drop-down list box) and the value (the value that is inserted into the field) are the same. You do not need to set the text and value to be the same.

The general syntax for manipulating the array of choices for these controls is:

object address.choice.list.method

See Also