B4J Question Get SelectedIndex from a B4xComboBox from a customListView Item

rgarnett1955

Active Member
Licensed User
Longtime User
Hi'

I have a button on a list view item panel that triggers a sub. The sub needs to pick up the SelectedIndex of a B4xCombo on the same list view panel:

B4X:
'======================================================================================================
Sub btnApplyFcn_Click
    Dim index As Int = curveListView.GetItemFromView(Sender)
    Dim p As Pane = curveListView.GetPanel(index)

    'Get the function ID
    For Each cmb As B4XView In p.GetAllViewsRecursive

        If cmb Is B4XComboBox Then
            If cmb.tag <> "" Then  Log("Tag = " & cmb.tag)
            If cmb.Tag = "spinFiltSel" Then
                Dim cp As ComboBox
                cp = cmb
                uRec.ID = spinFunctionMap.GetKeyAt(cp.SelectedIndex)
            End If
        End If
    Next
End Sub

When I create the list view item I "tag" the views within the items with their name in the tag field:

B4X:
    spinFiltSel.Tag                = "spinFiltSel"

This technique has worked for color pickers, labels and textFields, but I can't get it to work with the B4xCombo box e.g.

B4X:
'======================================================================================================
Sub getTextFieldStringValue (tagName As String, index As Int) As String
    Dim p As Pane = curveListView.GetPanel(index)

    For Each v As B4XView In p.GetAllViewsRecursive
        If v Is TextField Then
            If v.Tag = tagName Then
                Return v.Text
            End If
        End If
    Next
End Sub

How can I get the combo box values?

Best regards
Rob
 

rgarnett1955

Active Member
Licensed User
Longtime User


Hi Erel,

I had looked at that post, but I'm afraid I just don't understand how I would use this to get the combo box values. I think I understand that all the views of the custom control get stored in the mBase tag. but I don't understand the syntax to pick out one of the views within the list Item to operate on them.

I also wondered why my search method worked with some types of views, but not the combo box.

If you like I can make a little example app so you could put in the correct syntax.

Best regards
Rob
 
Upvote 0
Top