How to find the first view in a scrollview panel

gkumar

Active Member
Licensed User
Longtime User
I have a scrollview panel with 3 views in each row. I have assigned the same "Tag" for 3 views in a row (Row with some predefined row height).

My problem is when I click on any position on the row, I should be able to get the first view in the row to change some of its display properties.

How can I achieve this?

_Click event recognises selected views tag. But I want to get first view in the same row (even 2nd and 3rd views are selected)
 

mc73

Well-Known Member
Licensed User
Longtime User
The easiest way I can think of, is to extend your tag, in order to include the row and the column number, thus obtaining easily the column you need to edit. I don't know how you defined your 'tag', but it's easy to set it to a type, and then setting the neccessary fields.
 
Upvote 0

gkumar

Active Member
Licensed User
Longtime User
Thanks for reply.

I am assigning the 3rd views value as Tag for all the 3 views of the row because I need that value to be presented for other calculations.
 
Upvote 0

mc73

Well-Known Member
Licensed User
Longtime User
Thanks for reply.

I am assigning the 3rd views value as Tag for all the 3 views of the row because I need that value to be presented for other calculations.

Ok. Yet, supposing your value is named yourTag, you can dim in 'sub globals' a type:
B4X:
Type tagType(yourTag as string,rowPos as int,colPos as int)
.
This way, when you populate your scrollview, you can alter this by setting the appropriate row and column values for each view.
 
Upvote 0

gkumar

Active Member
Licensed User
Longtime User
Hello Mc73,
I will try this out. Meanwhile I have another question.

How can I identify the background color of the imageView (color drawable)?

I tried like,
If (imageView1.Color = Colors.Red) then,

But this line will not get compiled since Color is Write-only property.
 
Upvote 0

mc73

Well-Known Member
Licensed User
Longtime User
I think you can write your imageView color to a variable while you create it and change it whenever you want. At least, this is what I do when facing the problem of write only properties.
 
Upvote 0

gkumar

Active Member
Licensed User
Longtime User
I tried using,

Type tagType(yourTag as string,rowPos as int,colPos as int)

But in the _click() event,

Dim Send As View
Send = Sender
Msgbox(Send.Tag,"")

How can I extract the "yourTag" string from the Send.Tag?
 
Last edited:
Upvote 0

mc73

Well-Known Member
Licensed User
Longtime User
I tried using,

Type tagType(yourTag as string,rowPos as int,colPos as int)

But in the _click() event,

Dim Send As View
Send = Sender
Msgbox(Send.Tag,"")

How can I extract the "yourTag" string from the Send.Tag?

You can try this:
B4X:
dim tempString as string
dim tempTag as tagtype
tempTag=sender.tag
tempstring=tempTag.yourTag
 
Upvote 0
Top