GetViews Question

manios

Active Member
Licensed User
Longtime User
Hi,

I have several panels on a scrollview, each of the panels may several labels , imageviews and edittext views.
Is there a way to write to the edittext.text item on a specific panel by some sort of an index? I cannot use any direct adressing by name as the panels are generated during runtime and the number of panels is not static.

When I Log the views with GetViews I get the following:
B4X:
(ImageView): Left=2, Top=0, Width=32, Height=32
(TextView): Left=40, Top=0, Width=439, Height=30
(TextView): Left=40, Top=40, Width=240, Height=40, Tag=KUN;7
(EditText): Left=312, Top=40, Width=168, Height=40
(TextView): Left=312, Top=40, Width=168, Height=40, Tag=KUN
(EditText): Left=40, Top=80, Width=440, Height=100
I can get with FPanel(3).GetView(i).tag the tag information.
But how can I get further to the .text field of a EditText view?

Any suggestions?
 

klaus

Expert
Licensed User
Longtime User
Do you have an array of panels ?
Do you have the same number of views on each panel and are those always added in the same order.
If yes you can get the EditView with:
B4X:
Dim edt as EditText
edt = FPanel(3).GetView(i)
edt .Text = "Some text"
i is the index of the EditText view on the Panel.

Best regards.
 
Last edited:
Upvote 0

manios

Active Member
Licensed User
Longtime User
Solved!

Hi Klaus,

yes that did work. I store the panel index number in the tag and I know which index of the edittext views I want to adress on that panel.

So, dynamic, at runtime generated, forms are working now. I will not have to use the designer for large, complex input forms and assembling is done with the formatting data stored in a database table.

I have used this procedure for years with VB6 and managed large input forms with vitually no programming, once the toolbox was done.

Thanks again for the tip!
 
Upvote 0
Top