Dynamic Button
Please help me !
I have a idea,
there are 2 editText (Enter weight and hight of button) and one button with name "Creat Button". When I click "Creat Button", program automatic creat a new button with weight and hight to EditText. Change value to EditText, click "CreatButton", => size of button change! Done!
Sorry, I come from VietNam, my English not good. can you help me demo code example? Thanks all!
Hi icqrx,
Look this.
Sub Process_Globals
End Sub
Sub Globals
Dim lst As List
End Sub
Sub Activity_Create(FirstTime As Boolean)
Dim i As Int
Dim panels As Panel
panels.Initialize("panels")
panels.color = Colors.Gray
lst.Initialize
For i = 0 To 1
Dim edt As EditText
edt.Initialize("")
edt.Color = Colors.Green
edt.Text = "Here"
lst.Add(edt)
panels.AddView(edt, 10dip, 90dip, 300dip, 200dip)
Next
Dim btn As Button
btn.Initialize("Button")
btn.Text="Create Button"
btn.Tag = "Create Button"
panels.AddView(btn,10%x,10%y,50%x,20%x)
Activity.AddView(panels, 0, 0, 100%x, 100%y)
End Sub
Sub Button_Click
Dim i As Int
For i = 0 To lst.Size - 1
Dim edt As EditText
edt = lst.Get(i)
edt.Text = "Create Button " & i
Next
End Sub