iOS Question TableView with ActionButton event raise??

Discussion in 'iOS Questions' started by ilan, Jul 17, 2016.

  1. ilan

    ilan Expert Licensed User

    hi

    when i use a tableview (with iTableView2 lib) and add action buttons to it the SelectedChanged event will be raised on swipe and not on click.

    is that normal?
     
  2. Erel

    Erel Administrator Staff Member Licensed User

  3. ilan

    ilan Expert Licensed User

    hmmm, i am using an iphone 4s IOS 9.3.1

     
  4. Erel

    Erel Administrator Staff Member Licensed User

  5. ilan

    ilan Expert Licensed User

    ok i understand what is the problem @Erel
    when you add the tableview to a panel it will work as long as you wont have panel_click event
    because on click the panel catch the click and not the tableview

    try to add the tableview to a panel that also has a click event

    EDIT: the reason why my panels have click event is i want to prevent that on click (somewhere on the panel) an underlying button or panel wont catch that click so i add a click event to the panel and when you touch the panel catch the click but it should be that if the panel as views in it and they also have click (touch) event then they should catch the touch (this is how i understood it, the z order is important, the view that is in front should always catch the touch, correct?)
     
  6. Erel

    Erel Administrator Staff Member Licensed User

    This is expected as your panels consume the touch event. You can handle it instead of the SelectedChanged event.
     
  7. ilan

    ilan Expert Licensed User

    if i have a button in a panel and both have a touch (click) event i still can click on the button.

    how can i get the selected cell from the tableview by handling the panel click event??
     
  8. Erel

    Erel Administrator Staff Member Licensed User

    Maybe I misunderstood. Do you use custom views for the TableView items?
     
  9. ilan

    ilan Expert Licensed User

    No

    i just add the tableview (the same code as you post above) to a simple panel (instead to the page) and that panel also has a click event.

    the tableview code is the same as in your tableview example:

    Code:
    TableView1.Initialize("TableView1"False)
       
    For i = 1 To 1000
         
    Dim tc As TableCell = TableView1.AddSingleLine($"Item #${i}"$)
         tc.AddActionButton(
    "Delete"Colors.Red)
         tc.AddActionButton(
    "Change Value"Colors.Green)
       
    Next
       Page1.RootPanel.AddView(TableView1, 
    00100%x100%y)
    only instead of Page1.RootPanel.AddView(TableView1, 0, 0, 100%x, 100%y) i use Panel1.AddView(TableView1, 0, 0, 100%x, 100%y)
     
  10. Erel

    Erel Administrator Staff Member Licensed User

    If you can please create a small project that demonstrates the problem and upload it.
     
  11. ilan

    ilan Expert Licensed User

    sure :)
     

    Attached Files:

    • tv.zip
      File size:
      1.1 KB
      Views:
      52
  12. Erel

    Erel Administrator Staff Member Licensed User

    You are correct. The background panel consumes the touch event. Note that it is not related to the action buttons. You will need to remove the Click event from the panel.
     
  13. ilan

    ilan Expert Licensed User

    i can't, i need that panel click event (as mentioned above)

    anyway thanx erel.
     
  14. Erel

    Erel Administrator Staff Member Licensed User

    The TableView hides the views in the back. Are you sure that they are still clickable?
     
  15. ilan

    ilan Expert Licensed User

    do you mean the actionbuttons? if yes then yes they are still clickable. they act like usual buttons only the tableview items dont catch the clicks if i add the tableview to a panel that has a click_event.
     
  16. Erel

    Erel Administrator Staff Member Licensed User

    No. You said that you need to handle the panel's click event to avoid underlying views from being touched.
     
  17. ilan

    ilan Expert Licensed User

    oh sorry, i understand now you question. as you can see in the video my panel is about 80% of the screen size and the tableview doesnot cover all the panel size only a part of it so even if the tabelview will prevent underlying views to be clicked (after i remove the click event) there is still a small place where it can happen (below the tableview and between the 2 buttons)

    normally i always add to parent panels a click event that is empty only to avoid such a behavior. to be true i never understood why it is working like this in B4x that an underlying view can be clicked if the above view doesnot have a click event. in VB you cannot do this. is this a JAVA feature?

    EDIT: i guess i will need to move all views to 105%x instead of onlye ( visible = false ) when i switch between panels.
     
  18. Erel

    Erel Administrator Staff Member Licensed User

    You will need to add another panel under the TableView and handle its click event.

    Not really related to Java. This is how the Android and iOS UI frameworks work.
     
  19. ilan

    ilan Expert Licensed User

    i have under the tableview a panel that is a child of the main panel. so i will need to hande the touch event? and get the x/y of the touch and like this know what item was selected? (this could be a possibility, i also thought about it. i will see how to solve it) thanx erel
     
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