Android Question panel touch question

DPaul

Active Member
Licensed User
Longtime User
Hi, a "programming" question.

I can put a canvas on a panel and detect "touches" , finger down and up, x and y coordinates.
OK.
Imagine that my canvas is divided into areas, with lines visible across it.
Now i want to know which "area" was touched.

Question: i can do this with IF statements, style "if x < than ... and Y >... etc ", that is tedious.
It would be easier if i could do a select case, with some kind of "between" statements.
I think that is not possible, unless there is some B4A function i am unaware of.
Thanks for any advice.
Paul
 

DPaul

Active Member
Licensed User
Longtime User
What i could suggest is, once this routine is finished, to extract a smaller demo app
that does essentially the same, and put it somewhere for all to share.

There will be personal choices of course, eg. for the (slightly) different colors, i decided to go for concatenated strings
"R+G+B", to be retrieved via select case statements. You also could use the integer that represents the color,
but i like easy color recognition in the code. (You could also have variations in the alpha channel,
that way you can keep the colors the same, if there are not too many.)
In due time i'll come back to this.
Paul
 
Upvote 0
Top