Hi! I am new in using B4A.
May I know, what and how can we do to wrap the button or items in the panel to the next row or column when the panel is out of the room? I want to make a panel that can hold many buttons by codes but it will be out from the panel. I want to make the button go to the next row when the button is exceeding the panel width.
And if you don't mind, I want to know too about how we can keep the buttons on the p_stock_all when the button on p_stock_all is clicked. Because in the code, I used p_stock_all.RemoveAllViews but it will clear all the buttons in p_stock_all when I want it to stay and clear only when the other button on p_stock is clicked. Hope you guys can help me...
May I know, what and how can we do to wrap the button or items in the panel to the next row or column when the panel is out of the room? I want to make a panel that can hold many buttons by codes but it will be out from the panel. I want to make the button go to the next row when the button is exceeding the panel width.
And if you don't mind, I want to know too about how we can keep the buttons on the p_stock_all when the button on p_stock_all is clicked. Because in the code, I used p_stock_all.RemoveAllViews but it will clear all the buttons in p_stock_all when I want it to stay and clear only when the other button on p_stock is clicked. Hope you guys can help me...
B4X:
Sub Buttons
Dim CursorButton As Cursor
Dim id As Int
CursorButton = localsql.ExecQuery("SELECT * from b_stock_cat")
For i = 0 To CursorButton.RowCount-1
CursorButton.Position = i
Dim ButtonX As Button
Dim PosX As Pos
PosX.x = i
PosX.y = i+10
ButtonX.Initialize("Button")
ButtonX.Tag = PosX
ButtonX.Text=CursorButton.GetString("b_stock_cat_cat")
ButtonX.TextSize=12
p_stock.AddView(ButtonX,8,(i*130),250,140)
Next
End Sub
Sub Button_Click
p_stock_all.RemoveAllViews
Dim Button1 As Button
Dim name As String
Button1 = Sender
Dim Pos1 As Pos
Pos1 = Button1.Tag
Dim CursorButton As Cursor
CursorButton = localsql.ExecQuery("SELECT b.*, c.b_stock_cat_cat from b_stock b, b_stock_cat c WHERE (b.b_stock_cat_id = c.id) AND (b.or_id ='1' AND b.ou_id='1') AND c.b_stock_cat_cat = '"&Button1.Text&"'")
For i = 0 To CursorButton.RowCount-1
CursorButton.Position = i
Dim PosX As Pos
PosX.x = i
PosX.y = i+10
Button1.Initialize("Button")
Button1.Tag = PosX
Button1.Text=CursorButton.GetString("b_stock_name")
Button1.TextSize=10
p_stock_all.AddView(Button1,(i*180),10,180,150)
Next
End Sub