Editbox within Scrollview question

MattC

Member
Licensed User
Longtime User
I'm having trouble editing editboxes and labels within a scrollview.
Code to add my editbox within Activity_Create:
B4X:
Dim edt1 As EditText
   edt1.Initialize("edtStuff")
   edt1.text = ""
    edt1.Gravity = Gravity.CENTER_VERTICAL
   pnl.AddView(edt1, 140, pnl.height   , 120dip, height)
Once added I cannot find how to "address" it, I'm thinking it's something to do with initialising it (despite that being done in Activity_Create above). I thought I could just do this:
B4X:
edtStuff.text="New Stuff"
But this results in an undeclared variable
I declare the variable but while there are no errors there is also no change to the editbox:
B4X:
Dim edtholding As EditText 
edtholding.text="New Stuff"
I've searched and read many threads but i haven't seen how this is done, examples seem to set the value during Activity_Create but not change after that. It's also possible I'm missing something very basic that nobody else asks about.
 

MattC

Member
Licensed User
Longtime User
Bah, found it in another activity in the same project:
B4X:
Dim pnl As Panel
pnl = ScrollView1.Panel
Dim lbl As Label
lbl = pnl.GetView(0)    
lbl.Text="success!"

:signOops:
 
Upvote 0
Top