Android Question How touchable all view in panel

devmobile

Active Member
Licensed User
I have many labels in panel that contain numbers
I need to user when touch label and when user slide to left or right,i can understand how label is touching
Example user maybe select number from 1 to 10 so user touch number 1 and slide to number 10
Please answer to me guys
I apologize to Erel for last problems
 

devmobile

Active Member
Licensed User
B4X:
Dim Panel1 as Panel
Button1 =  Panel1.Parent

Panel1.getview(0) 'the chronological order of the views in the panel
No No
I add this event for panel
Sub pnl_Touch(Action as int,X as float,Y as float)

ENd Sub


I have many label in panel
But when i touch on label,not raise touch event but when i touch part of panel,it raised
 
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
Try this

B4X:
Sub pnl_Touch(Action As Int,X As Float,Y As Float)
    Dim NumLab As Int = X /40dip ' if labels are 40dip
    Dim MyLabel As Label = pnl..getview(0) ' If are present only label
    Dim Tag As String = MyLabel.Tag
  
    Log("Clicked Label number : "  & Tag)
End Sub

Assuming there are only labels in the panel
and one under the other
 
Upvote 0

devmobile

Active Member
Licensed User
Try this

B4X:
Sub pnl_Touch(Action As Int,X As Float,Y As Float)
    Dim NumLab As Int = X /40dip ' if labels are 40dip
    Dim MyLabel As Label = pnl..getview(0) ' If are present only label
    Dim Tag As String = MyLabel.Tag
 
    Log("Clicked Label number : "  & Tag)
End Sub

Assuming there are only labels in the panel
and one under the other
My friend you mistake
When i touch on label,Touch Event didn't raise and so i cannot detect touch
When i touch part of panel that not exist label,Touch Event raised
 
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
Set Name Label Event empty
 
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
I understand that you do not want to capture the label Event but the panel event raised.

To prevent the event from raising you need to set the label so:

Label1.Initialize ("")

If you design it, the name of the event must be empty

so the panel event will be raised and captured
 
Upvote 0

devmobile

Active Member
Licensed User
I understand that you do not want to capture the label Event but the panel event raised.

To prevent the event from lifting you need to set the label so:

Label1.Initialize ("")

If you design it, the name of the event must be empty
Ok please let to me for try it
Thanks
I will coming soon
 
Upvote 0

devmobile

Active Member
Licensed User
I understand that you do not want to capture the label Event but the panel event raised.

To prevent the event from raising you need to set the label so:

Label1.Initialize ("")

If you design it, the name of the event must be empty

so the panel event will be raised and captured
I try it and i working Very Thanks
But there is other problem
I add labels in scrollview
But we cannot detect touch for scollview
Is right?
 
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
Please open new thread for this new question.
 
Upvote 0
Top