iOS Question barbutton question

moore_it

Well-Known Member
Licensed User
Longtime User
hi all,

i've a problem with barbuttons when i wanto to create a toolbar via code.
For example if i try this code

B4X:
Public Sub ToolBarCommands(ButtonsPage As Page,ButtonsTypes() As Int,ButtonsBmps() As String,ButtonsTags() As String)
    Dim listToolBarButtons As List
    listToolBarButtons.Initialize

    For i = 0 To ButtonsTypes.Length - 1
        Dim btn As BarButton
        Select Case ButtonsTypes(i)
        Case 0 ' flexible space           
            btn.InitializeSystem(btn.ITEM_FLEXIBLE_SPACE,"")           
        Case 1 ' image
            Dim btm As Bitmap
            btm.Initialize(File.DirAssets,ButtonsBmps(i))
            btn.InitializeBitmap(btm,ButtonsTags(i))   
        Case 2 ' search
             btn.InitializeSystem(btn.ITEM_SEARCH,ButtonsTags(i))            
        End Select
        listToolBarButtons.Add(btn)
    Next
   
    ButtonsPage.ToolbarButtons = listToolBarButtons
End Sub

the result is buttons without spaces.
if i add this code before the next statement

B4X:
Dim btn As BarButton
btn.InitializeSystem(btn.ITEM_FLEXIBLE_SPACE,"")           
        listToolBarButtons.Add(btn)

i've a space but not like if i made with designer ...

where i wrong ???

thanks in advice
 
Top