• Not Answered

Animation based on number of Items in a ComboBox

For option selection in a graphic a ComboBox is used. This Combox is filled with selectable Items using a script.
Depending on the number of items in the ComboBox it is to be enabled or disabled.

The state in the process (DeltaV parameter) is to be used to enable or disable the ComboBox also.
Now I cannot get the Enable Animation to work on the expression 'parameter AND ComboBox.Listcount.
In the scripts the ComboBox.Listcount is working correctly. This is not the case in the Animation however.
Using the parameter only is working good. The ComboBox.ListCount seems to result in a 0 (zero) always.

How can I get the number of Items in a ComboBox into an animation expression?

3 Replies

  • You will likely have to have that ListCount saved to something like an iFix variable from the script that loads the combobox selections as I don't believe those combobox properties are updated in the graphics environment. Then you can reference that iFix variable in your animation and it should work.
  • In reply to Matt Stoner:

    Thanks for the answer Matt.
    I tried the use of a picture parameter before an now again (Me.Parameter.CurrentValue = Box3.ListCount), but the value of the parameter remained 0. Now I decided to use the property 'ListRows' of the ComboBox. This value is default 23. In my case the number of Items is always lower than 23 so this seems a good option. In case the value would be higher than 23, more items will be in the dropdown list, what is acceptable.
  • In reply to Maarten van der Waal:

    Where is the logic that is creating the selections of the combox? You would do your counting in that script and save it to the iFix Variable.

    I did a quick test and the ListCount works during that script, you just need to save that value somewhere the graphic can reference:

    Private Sub cboTest_DropButtonClick()
    On Error GoTo ErrHandler

       Dim i, z As Integer

       z = InputBox("Enter number of choices")
       cboTest.Clear

       For i = 1 To z
           cboTest.AddItem "Entry " & i
       Next i

       MsgBox cboTest.ListCount
    Exit Sub
    ErrHandler:
       frsHandleError
    End Sub