Android Question [Solved] How to add an event to ScrollView with Label?

anOparator

Active Member
Licensed User
Longtime User
ImageView1 and Button1 are created in Designer.

scroText(ScrollView) and scvLabel(Label) are created in code.
I can clear the opening Designer views with Button1_Click or ImageView1_LongClick.

How do I add a _LongClick Event to the scvLabel(Label) and return to the opening screen display?

Thanks In Advance
 

Attachments

  • 1scvLabel.zip
    73.6 KB · Views: 142

mangojack

Expert
Licensed User
Longtime User
How do I add a _LongClick Event to the scvLabel(Label) and return to the opening screen display?
Thanks In Advance

Just add the following sub ...
B4X:
Sub scvLabel_LongClick
   ImageView1.Visible=True
   Button1.Visible=True
   scvLabel.Visible=False
   scvLabel.SendToBack
End Sub

but .. without knowing exactly what your trying to achieve it is hard to suggest, but I think your overdoing hiding views and sending them to back and front.
You load a Label to the Scrollview .. at the start just set ScrollView.Visible to false. forget about the label.

then all your left with ...
B4X:
Button1_Click
  scroText.Visible = True
  Button1.visible = False
End Sub

Sub scvLabel_LongClick
   scroText.Visible = False
   Button1.visible = True
End Sub

You can then trim the other views click code as well ... as I said you might have other reasons to do it this way.
 

Attachments

  • scnLabel 1.zip
    73.7 KB · Views: 131
Last edited:
Upvote 0

anOparator

Active Member
Licensed User
Longtime User
Just add the following sub ...
B4X:
Sub scvLabel_LongClick
   ImageView1.Visible=True
   Button1.Visible=True
   scvLabel.Visible=False
   scvLabel.SendToBack
End Sub

but .. without knowing exactly what your trying to achieve it is hard to suggest, but I think your overdoing hiding views and sending them to back and front.
You load a Label to the Scrollview .. at the start just set ScrollView.Visible to false. forget about the label.

then all your left with ...
B4X:
Button1_Click
  scroText.Visible = True
  Button1.visible = False
End Sub

Sub scvLabel_LongClick
   scroText.Visible = False
   Button1.visible = True
End Sub

You can then trim the other views click code as well ... as I said you might have other reasons to do it this way.
thanks a lot.
I was mistakenly tinkering with the ScrollView event, and focused on the Label event while typing this post. Now I've learned the difference.

kudos , I'm toggling between views now.
 
Upvote 0
Top