iOS Question Tableview click selected

Discussion in 'iOS Questions' started by Samplatiner, Aug 12, 2015.

  1. Samplatiner

    Samplatiner Member Licensed User

    Good morning b4x-communicty,


    I have a question to the tableview.

    I want to detect clicks and longclicks, but they do not have Parameters, which row is clicked.

    this thread
    http://www.b4x.com/android/forum/threads/tableview-click-longclick-and-clicked-cell.52981/

    says, i sould use selectedchange, but this Event does not fire as Long as I have a click/longclick-detection active.

    So how to get which line his been clicked?

    I would be happy about a good hint :)


    Best regards,

    Daniel
     
  2. Samplatiner

    Samplatiner Member Licensed User

    I have to correct this a bit.

    Only the Click-Event (even if empty) blocks the selectedchange-Event

    if I comment the click-Event, the selectedchange-Event fires
     
  3. Erel

    Erel Administrator Staff Member Licensed User

    You should use TableView Click events. It will consume the touch event and prevent the SelectedChange from firing.
     
  4. Samplatiner

    Samplatiner Member Licensed User

    I used the click Events and I yes, they block the selectedchange-Event

    but that's the Problem. without the selectedChange-Event I do not know, on which row the user has klicked, so I can't start the interaction with the click row.

    How do I get the Information, on which row the user has clicked? the click Event does not have any Parameters

    Edit:
    A Screenshot:
    http://www.pic-upload.de/view-27979550/pic.png.html
     
  5. Samplatiner

    Samplatiner Member Licensed User

    do I have maybe an old Version of Tableview? it's 1.2
     
  6. Samplatiner

    Samplatiner Member Licensed User

    no, 1.2 is the new one, that's not the problem
     
  7. Erel

    Erel Administrator Staff Member Licensed User

    You shouldn't handle the Click event. You can add custom views to the items and then handle their events. For example you can add panels and handle their click events.
     
    Samplatiner likes this.
  8. Samplatiner

    Samplatiner Member Licensed User

    great, that's perfect.

    thanks a lot, that works great.

    while creating the rows now I have added the index as a tag to the Panels.

    Every Panel has the same eventname, so it's that easy:

    Code:
    Sub pnlTableTablet_Click
      
    Dim pnl As Panel=Sender
      
    Dim index as int=pnl.Tag
    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