B4J Question Silder Values to a Textfield in a Listview

alienhunter

Active Member
Licensed User
Longtime User
Hi to all ,

i have created a listview with the following code
and i added sliders to this list , but now i am stuck sending the value from each slider to the textfield in the same row.
each slider and text have the same tag from the loop.
for some reason i cannot get it to run (brainf...)

thanks AH



B4X:
Sub nccomment_MouseClicked (EventData As MouseEvent)

cnclist.Items.Clear

For i =0 To ncselectx.Items.Size-1

Dim p As AnchorPane
p.Initialize("")
p.LoadLayout("cnclisttime")
p.Style="-fx-background-color : rgb("& Rnd(100,150)&"," & Rnd(100,150)&"," & Rnd(100,150)& ")"

cncpgmtime.Text= ncselectx.Items.Get(i)
ncselectx.Tag=i ' text
cnctimetick.Tag=i ' slider

cnclist.Items.Add(p)
Next


   
End Sub

Sub    cnctimetick_ValueChange (Value As Double)

Dim timesend  As Slider=Sender
 .... stuck here 


End Sub
 

Attachments

  • listview.jpg
    listview.jpg
    91.9 KB · Views: 289

stevel05

Expert
Licensed User
Longtime User
You can use this code to get a list of all nodes with a particular tag:

B4X:
'Find All Nodes with the TAG field value of TAG1

Sub FindAllNodesFromTag(Pane1 As Pane,TAG1 As Object) As Object()
    Dim Found As List
    Found.Initialize
    For Each N As Node In Pane1.GetAllViewsRecursive
        If (N.TAG = TAG1) Then Found.Add(N)       
    Next
    'Convert the list to an array
    Dim JO As JavaObject=Found
    Dim FoundRes() As Object = JO.RunMethod("toArray",Null)
    'And return it
    Return FoundRes
End Sub

The second half just converts to an array, so you can ignore it if you wish and just use the list.

You could change the tag assignment so the tags are unique, one for the slider and one for the text box, and get it directly and exit the loop when it's found. Or you can check the two items that will be returned to see which is the text box and change it's text.
 
Upvote 0
Top