hexagon logo

ListBox, ComboBox, Drop-Down List

I've worked out that how to create a drop-down list using the following code which was given in PCDMIS help file for sample and it works fine

After execution of the script, The combo-box plays well, it returns the text which i selected from the list, but
The list-box and the drop-down List is returning the position of the selected text from the list ...............

can someone help me that how to retrieve the item From the list for listbox & dropdown list............

Sub Main

Dim MyList$ (5)
MyList (0) = "AAA"
MyList (1) = "BBB"
MyList (2) = "CCC"
MyList (3) = "DDD"
MyList (4) = "EEE"
MyList (5) = "FFF"

Begin Dialog BoxSample 16,35,256,89,"List Box, Combo Box, and Drop-Down List Box"

    OKButton 204,24,40,14
    CancelButton 204,44,40,14

    ListBox 12,24,48,40, MyList$( ),.Lstbox
    DropListBox 124,24,72,40, MyList$( ),.DrpList
    ComboBox 68,24,48,40, MyList$( ),.CmboBox

    Text 12,12,32,8,"List Box:"
    Text 124,12,68,8,"Drop-Down List Box:"
    Text 68,12,44,8,"Combo Box:"

End Dialog

Dim Dlg1 As BoxSample
Button = Dialog ( Dlg1 )

Chklist = Dlg1.Lstbox
Chkcombo = Dlg1.CmboBox
ChkDrop = Dlg1.DrpList

MsgBox (Chklist)
MsgBox (Chkcombo)
MsgBox (Chkdrop)


End Sub

Parents Reply Children
  • But also another level of sparse documentation… I may be blind, but I haven't found out how to get the value of a ComboBox back to the part program, or how to fill a normal Listbox with static data. I'm usually good at finding things in the Help, but this has stumped me, I have to admit...
  • You need to use:

    PARAM/Combobox1.TEXTVALUE=V1 (or V1=Combobox1.TEXTVALUE - can't remember which way round it is) to get the value of a combo box back to an assignment.
  • PARAM/Combobox1.TEXT=V1

    The User Interface for Forms is just awful:
    1) Insert form call. A blank line appears: PARAM/=
    2) Use your magnifying glass to carefully click your cursor into the 2-pixel wide blank between the / and the =
    3) Laboriously type in the full exact name of the item on the form, then .TEXT for text input or .VALUE for numerical input.
    4) Carefully hit the Tab key exactly once to skip cursor focus to the right of the =
    5) Laboriously type in the name of the already-existing variable in your PRG that you want the junk to dump into.
    6) After you click out, a new blank PARAM/= appears below. Repeat.

    Seriously, no dialog interface whatsoever - just tribal knowledge of a painful and not-at-all-obvious interface.

    7) * Bonus ability: if you assign the variable a value before the Form is called, that value will be displayed as the Default in the Form when it runs. I'm pretty sure everyone in a certain factory is still using "Bob" as the inspector name for every CMM run... even though Bob retired. *
  • There's a "tutorial" in the help file on building a custom form. While's it complete or exhaustive, with enough brain power and context clues you can build a successful form. I did for my programs.