Android Question UltimateListView change label text by button click

Discussion in 'Android Questions' started by Alexander Stolte, Mar 25, 2017.

  1. Alexander Stolte

    Alexander Stolte Well-Known Member Licensed User

    Hey Community,

    I create a list with the UltimateListView and fill the list with my layout, on this layout are 3 Buttons and any labels.

    Here a small section:
    button on layout.PNG
    How can i give the first label +1 when i press the smylie? the Smylie is an Button.

    I've tried it, but do not come any further:

    Code:
    Sub ulv_ItemClick(ItemID As Long, Position As Int, ClickedPanel As Panel)
        
    'Log(ItemID)
       Dim pnl_main As Panel = ClickedPanel.GetView(0)
        
    Dim btn_up As Button = pnl_main.GetView(6)
        
    Dim lbl_counter As Label = pnl_main.GetView(5)
       
        
    'if counting = 1 Then
            'opo = lbl_counter.Text
            'ToastMessageShow(opo, True)
            'lbl_counter.Text = opo +1
            'counting = 0
        'End If
    '    counting = lbl_counter
        'Log(btn_up.)
       
       
    End Sub
    Thanks for help!
     
  2. Alexander Stolte

    Alexander Stolte Well-Known Member Licensed User

    In the documentation is the following:
    Does anyone have an example, how the code looks like?
     
  3. MarcoRome

    MarcoRome Expert Licensed User

    This is GREAT Library.
    You have your answer HERE
     
  4. Alexander Stolte

    Alexander Stolte Well-Known Member Licensed User

    Unfortunately does not bring me further :/
     
  5. MarcoRome

    MarcoRome Expert Licensed User

    Mhhh... do you use maps. Pls paste your code
     
  6. Alexander Stolte

    Alexander Stolte Well-Known Member Licensed User

    i dont use maps.

    Code:
    Sub clv2_LayoutCreator(LayoutName As String, LayoutPanel As Panel)
        LayoutPanel.LoadLayout(
    "frm_mainlayout")
    End Sub

    Sub clv2_ContentFiller(ItemID As Long, LayoutName As String, LayoutPanel As Panel, Position As Int)
        
    Dim Panel1 As Panel = LayoutPanel.GetView(0)
        
    Dim lbl_content As Label = Panel1.GetView(0)
        lbl_content.Text = 
    "Nur mit Seil und Haken gesichert auf einem schmalen Grat balancieren."

    Sub clv2_ItemClick(ItemID As Long, Position As Int, ClickedPanel As Panel)
    '    Log(ItemID)
    '  
        Dim pnl_main As Panel = ClickedPanel.GetView(0)
        
    Dim btn_up As Button = pnl_main.GetView(6)
      
        btn_up.Tag = btn_up
        
    ToastMessageShow(btn_up.Tag, True)
      
        
    Dim lbl_counter As Label = pnl_main.GetView(5)
    'btn_up.Tag = clv2.
    'ToastMessageShow(ItemID, True)

        
    'if counting = 1 Then
    '        opo = lbl_counter.Text
    '        ToastMessageShow(opo, True)
    '        lbl_counter.Text = opo +1
    '        counting = 0
        'End If
    '    counting = lbl_counter
        'Log(btn_up.)
      
        
    'ToastMessageShow( clv2.GetItemID(Position), True)
    End Sub

    Sub clv2_ItemSelectedStateChanged(ItemID As Long, Position As Int, Selected As Boolean)
        
    'Log("SelectionChanged ID=" & ItemID & ", Pos=" & Position & ", Selected=" & Selected)
      
      
    End Sub





    Sub btn_up_Click
    'Dim Index As String = Sender
    'Log("Index: " & Index)

    Dim b As Button = Sender
    ToastMessageShow(b, True)
    'Log("Button: " & b)
    'ToastMessageShow(counting, True)
    'Dim btn_up As Button = Sender
    'Dim ID As Int =  btn_up.Tag
    'ToastMessageShow(ID, True)
      
      

        counting = 
    1
    End Sub
    End Sub
    I load a Layout from the designer, on this layout are the labels and buttons.
    layout.PNG

    If i press "btn_up" should on "lbl_counter" +1
    I have no idea, because I do not know how I get the ID of the button in the "btn_click" event to then change the label.
     
  7. Informatix

    Informatix Expert Licensed User

    To get the click event of a button, you just have to declare the _Click event sub as usual. To get the ID of the item in this sub, please read the documentation or look at examples.
     
    Alexander Stolte likes this.
  8. ttsolution

    ttsolution Member Licensed User

    Sub cmdOrder_CLick
    Msgbox(lstCustomer.FindIDInVisibleItems(Sender),"")
    End Sub
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice