Hi
In my APP I am adding buttons on runtime
I have a Sub that include
B4X:
Sub AddButton (Lefts As Int, Tops As Int,Wid As Int, high As Int,Tags As String,Names As String )
'The Name is the text of the button
Dim buttonx As Button
buttonx.Initialize ("buttonx")
buttonx.Tag=Tags
buttonx.Text=Names
Activity.AddView (buttonx,Lefts,Tops,Wid,high)
End Sub
I may request this sub about 15 as max I tried this code
B4X:
Dim left1 As Int
Dim top1 As Int
For bb= 0 To 15
left1=30
top1=top1+150
Dim xy,yy As String
AddButton (left1,top1,75dip,75dip,"but"&bb,bb)
Next
The code work fine but how can I make the button start from the top with a different left when the adding process reach the end of the Activity layout
Dim bb, left1, top1, space As Int
space = 85dip
left1 = 10dip
top1 = 10dip
For bb = 0 To 15
AddButton(left1, top1, 75dip, 75dip, "but" & bb, bb)
top1 = top1 + space
If top1 + space > 100%y Then
left1 = left1 + space
top1 = 10dip
End If
Next