Android Question Sender, Tags and Array of Labels

trepdas

Active Member
Licensed User
Hi all.

I managed to handle sender with tags and control buttons as array.

BUT still can't figure out how to do this in b4a :

for i = 0 to 9
label(i).visible = false
next

any help?

Sorry for the novice question and Thanks.
 

trepdas

Active Member
Licensed User
in vb6 I created 9 labels Called it "Sign" .
Created the first and then copy pasted it (Vb6 asks if I want to make it an array - I Chose "yes")

now, I indexed it with 1-9.
so I have : Sign(1), Sign(2), Sign(3) etc....

Now, I want to change Sign(3)

Since I can index the labels in VB6 - I would simply code:
Sign(3).visible = False

how would it be like in B4A ?
 
Upvote 0

XbNnX_507

Active Member
Licensed User
in vb6 I created 9 labels Called it "Sign" .
Created the first and then copy pasted it (Vb6 asks if I want to make it an array - I Chose "yes")

now, I indexed it with 1-9.
so I have : Sign(1), Sign(2), Sign(3) etc....

Now, I want to change Sign(3)

Since I can index the labels in VB6 - I would simply code:
Sign(3).visible = False

how would it be like in B4A ?
In order to help you, you need to post the code you used.
How you define the array of buttons ?
 
Upvote 0

trepdas

Active Member
Licensed User
ok.
Labels behave like Buttons...
Yes.
I am dumb.

So I simply do the same with buttons. create a common eventname and then use sender.
ok.....
 
Upvote 0

trepdas

Active Member
Licensed User
....
Let's conclude that with an advice for all of us newbies :
Read the attached tutorials.
Go through the source code.
The basic is there...
:)
 
Upvote 0

megzz

Member
Licensed User
Hi all.

I managed to handle sender with tags and control buttons as array.

BUT still can't figure out how to do this in b4a :

for i = 0 to 9
label(i).visible = false
next

any help?

Sorry for the novice question and Thanks.


append this line in between code

B4X:
label(i).tag = i

simple:
B4X:
for i = 0 to 9
label(i).visible = false
label(i).tag = i
next

so in click to any lable you can control this
for example :

B4X:
sub label_Click
dim lbl as lable
lbl = sender
dim index as int
index = lbl.tag
label(index).color = colors.red
end sub

lable variable should is public
 
Upvote 0
Top