MMCC MASTHEAD


INDEX

Main PL/B Page

Mid-Michigan Computer Consultants, Inc.
509 Center
Bay City, Michigan
Sales (989) 892-9242             Support (989) 686-8860

ANSI Standard PL/B Language
ComboBox


A combo box is one of those one liners with a DOWN ARROW on the right end. When you click the down arrow you get a table of things you can do.

LIST SIZE:
In the designer you set the length of the dropdown by clicking on the ListData property. That gives you a window and you can add items for the initial list. You can also add blank lines to just set the size of the dropdown.

Thst sets the screen dropdown size only. You can put a ton of items into the actual list. Not sure what the limit is.
STYLE:
There are three values for ComboStyle
Dropdown Edit: allows the user to enter ANYTHING in to the field. It doesn't have to be in the list.

Dropdown List: You can key something but it has to be in the list. If you key the first letter the list will auto jump to that item. Really nice. The item MUST be in the list.

Simple: You can ONLY use the drop down to select the value and the value, by definition, must be in the list.

LOADING THE LIST
You can, of course, pre-load the list from the designer as mentioned above.

In the program you LOAD the initial values of the Combo box like this:
     DELETEITEM    {combobox}, 0            ; Clear entire list

     INSERTITEM    {combobox},99999,{data}  ; Insert at END of the list

     INSERTITEM    {combobox},nnn,  {data}  ; Insert at a specific line

You can do a loop with a specific index value ("nnn") to fill the list. That is,
        MOVE          ZERO,IX1               ; Initialize the index
        LOOP
          ADD         ONE, IX1               ; increment index
          INSERTITEM  {combobox},IX1,{data}  ; Put {data} in line IX1
        REPEAT UNTIL {condition}
You can also loop and use the 99999 to tack onto the end of the list.
        LOOP
          INSERTITEM  {combobox},99999,{data}  ; Put {data} in LAST line
        REPEAT UNTIL {condition}

Use the specific index technique if you want to remember where a specific item is stored. For example: Say that you load a list with salesmen. When done you want to position to a particular person. To do this you load the list to specific locations looking for "your" salesman. When you find that person, you remember the index number.
        MOVE          ZERO,IX1               ; Initialize the index
        MOVE          ZERO,OURGUY            ; Don't know which line
        LOOP
          ADD         ONE, IX1               ; increment index
          INSERTITEM  {combobox},IX1,{data}  ; Put {data} in line IX1
          IF ({data} = {our salesman})       ; Is this our guy?
              MOVE    IX1, OURGUY            ; When true, remember IX1
          ENDIF
        REPEAT UNTIL {condition}
        SETITEM       {combobox},0,OURGUY    ; Point to our salesman


POINTING TO AN ENTRY:
As mentioned above, you may want to pre-set the list to point to a specific line. Do that with the SETITEM as follows:
        SETITEM {combobox},0,{index}    ; Point to line at {index}


GETTING DATA OUT OF THE LIST:
You retreive data from the combobox with a standard GETITEM instruction. What you get depends on the STYLE of the list and how you code the GETITEM instruction.

The first parameter to the GETITEM names the combobox object that you're working with.

The SECOND parameter is the number of the list item that you want. The value will be zero if either it doesn't matter (example 1 below) or when you're asking for the value of the top entry (example 3).

The third parameter's type determines how the instruction works. If the third item is a CHARACTER STRING you'll get data from the list. If the third item is a NUMBER you'll get the index to the line that was clicked.

The STYLE comes into play on the third example below. For an EDIT style list (where the user can key anything into the combobox's top line), you can use index ZERO to get the top line as it appears to the user.
    GETITEM {combobox}, 0,   {numeric}   Gets the index of currently
                                         active item in the list



GETITEM {combobox}, nnn, {string} Gets the contents of the entry number "nnn".

GETITEM {combobox}, 0, {string} Get the actual value keyed but only if this is a style EDIT where they can put anything in the field.


FORMATTING THE COMBOBOX:
Combobox contents are simple strings. You can load a list with data like this.
        LOOP
          PACK        WORK_STRING,ID, NAME, ADDRESS ; build string
          INSERTITEM  {combobox},999999,WORK_STRING ; put in list
        REPEAT UNTIL {condition}
The above list will not produce nice columns of data as you might expect UNLESS you control the font. If you use a proportional font the data will appear like this:
101 John Jones 600 Lakeshore Drive 101 Larry Lewis 1420 Mountain 103 Susie Sunshine 980 Summer Circle
To arrive at nice columns you must use a FIXED font such as Courier. You can select the font when building the form in the forms designer.
         101   John Jones         600 Lakeshore Drive
         101   Larry Lewis       1420 Mountain
         103   Susie Sunshine     980 Summer Circle

INDEX

v1.10
Send e-mail to MMCC.

Write to MMCC Technical Support at:
MMCC, Inc.
600 W. Midland
Bay City, MI 48708
(989) 686-8860
| Home   |

© 1997 MMCC, Inc. All Rights Reserved.

Report problems or suggestions to support@mmcctech.com
Since 09/15/1998