Selecting/Identifying a View

TedN

Member
Licensed User
Longtime User
What is the best method of selecting/identifying a view, i.e. a finger or cursor are within a view boundaries.

If I have mapped all of my views would one normally loop through all of the views in the map until a view is identified having boundaries "enclosing" the XY of the finger/cursor. Or is there a more efficient method.

Thanks,
 

klaus

Expert
Licensed User
Longtime User
What exactly do you want to do.
B4A is event driven, for the different views different events are raised depending on what the user is doing. Then you can define event routines to do what you need for that event.
Examples:
Button1_Click
Activity_Touch
etc.

Best regards.
 
Upvote 0

TedN

Member
Licensed User
Longtime User
Klaus,

I've just found what was happening. Ridiculously simple. I was actually using EditTexts stored in a map. When I called them up I couldn't get the Click event routine to work. I then realized a double click was required with the EditTexts to fire the event routine. I guess the first click is for focus.
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
The EditText view doesn't have a Click event!
What do expect when you click on an EditText?
The events for the EditText view in B4A are:
- EnterPressed
- FocusChanged (HasFocus As Boolean)
- TextChanged (Old As String, New As String)

Best regards.
 
Upvote 0

thedesolatesoul

Expert
Licensed User
Longtime User
Actually EditTexts do support the Click event. I'm not sure if they are listed when you Generate Members, but if you manually create a sub, the click event will fire.
However, it fires only when it already has the focus.
I used it to show a TimeDialog. (so in effect the user is never able to enter any text). Probably a better idea would be to use a label in that case however.
 
Upvote 0
Top