Android Question selectively hide edtxt i/p

Laurie

Member
Licensed User
Longtime User
I have an array of edtxt.text boxes in a scrollview.
Is it possible to selectively make some of them invisible?
 

Andrew (Digitwell)

Well-Known Member
Licensed User
Longtime User
Yes it is.
You will need some way of identifying the views you want to make invisible, maybe hold them in an external list.
you can then do something like:

B4X:
...
for each ed as b4xview in listofviews
 ed.visible = showthisview(ed)
next
...

private sub showthisview(ed as b4xview) as boolean

'    return true or false based on some criteria
end sub

Did you want to also hide the gaps? It may be better to use a CustomListview rather than a scrollview.
 
Upvote 0

Laurie

Member
Licensed User
Longtime User
I had been trying to use
EdTxt.Visible=False
within a for next loop

That didn't work, but isn't your suggestion essentially the same?
Also within the loop were (non input examples) par(i).visible=false which works fine??
 
Upvote 0

Andrew (Digitwell)

Well-Known Member
Licensed User
Longtime User
Not exactly, the key was the line, hold them in an external list.

Take a read of this for pointers.


The key thing to remember is that if you load a layout multiple times, the variables only point to the last instance created, which is why you need to create a list of them on creation.
 
Upvote 0
Top