User's Guide


Adding a drop-down list

In the previous example, the user's input must not just match a general format; it must be a specific item from a predefined list. In a situation such as this, you might use a drop-down list as follows:

  1. Replace the State Text part with a Drop-down List named StateText.
  2. Add the following script:
    x populateList
       "Add U.S. state names to the drop-down list"
       | stateNames |
       stateNames := OrderedCollection new.
       (1 to: 53)
          do: [:i |
             stateNames add: (AbtUSAState fromOrdinal: i) printString].
       (self subpartNamed: 'StateText') items: stateNames.
    
  3. Add an event-to-script connection from the openedWidget event of the window to the populateList script.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]