Listbox

Listbox

  • 30 Januar 2020 um 12:10 am #35483
    simon
    Teilnehmer

    I have a problem that I think must be able to overcome. I have a screen which has a ‚Tab group‘ on it. I have many tabs which have listboxes on them. I have a listbox variable which is a word (16bit) which I need as a number. I also need the string selection. I can get this with

    Public Sub Click()
    Set objCombo = GetSynopticObject().GetSubObject(„Tailcornsilo1Lb“)
    Set objDisplay = objCombo.GetObjectInterface()
    Set objList = objDisplay.GetComboListInterface
    sListItems = objList.GetText(objList.GetSelectedIndex)

    Set objDisplay = Nothing
    Set objList = Nothing
    Set objCombo = Nothing
    End Sub

    The problem I have is if I run the project with the screen only not in a tab then the code works. When I run the main screen with the tab group on the the code fails with „Active Automation: Object var is ‚Nothing'“

    Is there a way to get both the listbox index and string into a variable?

  • 31 Januar 2020 um 3:50 pm #35496
    ThomasIslera
    Teilnehmer

    Hi Simon,
    The error tell that you are not referencing the object properly with this script….

    try like this

    Dim objSyn As SynopticCmdTarget

    Dim objTabGroup As DrawCmdTarget

    Dim objDraw As DrawCmdTarget

    Set objSyn = GetSynopticObject

    Set objTabGroup = objSyn.GetSubObject(„TabScreen“)

    Set objDraw = objTabGroup.GetSubObject(„Tailcornsilo1Lb“)

    But you can’t simplify the process by putting 2 separate variables for each list box and eventually going to populate only the value of these variables via script without interface the object via script.
    I mean only „play“ on the variables value to dynamically fill the list box items

    BR
    Thom

  • 31 Januar 2020 um 10:27 pm #35497
    simon
    Teilnehmer

    Thank you I will give it a try.

Du musst angemeldet sein, um auf dieses Thema antworten zu können.

Topic Tags