iOS Question TableView with ActionButton event raise??

ilan

Expert
Licensed User
Did you try it with the exact code from this example: https://www.b4x.com/android/forum/threads/tableview-action-swipe-buttons.61111/ (+ the event sub) ?
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?)
 

ilan

Expert
Licensed User
This is expected as your panels consume the touch event
if i have a button in a panel and both have a touch (click) event i still can click on the button.

You can handle it instead of the SelectedChanged event.
how can i get the selected cell from the tableview by handling the panel click event??
 

ilan

Expert
Licensed User
Maybe I misunderstood. Do you use custom views for the TableView items?
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:

B4X:
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, 0, 0, 100%x, 100%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)
 

ilan

Expert
Licensed User
The TableView hides the views in the back. Are you sure that they are still clickable?
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.
 

ilan

Expert
Licensed User
No. You said that you need to handle the panel's click event to avoid underlying views from being touched.
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.
 

Erel

Administrator
Staff member
Licensed User
(below the tableview and between the 2 buttons)
You will need to add another panel under the TableView and handle its click event.

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?
Not really related to Java. This is how the Android and iOS UI frameworks work.
 

ilan

Expert
Licensed User
You will need to add another panel under the TableView and handle its click event.
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
 
Top