Private Sub CreateToolbar (DesignerArgs As DesignerArgs)
Dim pnl As B4XView = DesignerArgs.GetViewFromArgs(0)
If DesignerArgs.FirstRun Then
Dim StubLabel As B4XView = pnl.GetView(0)
StubLabel.RemoveViewFromParent
Dim EventName As String = DesignerArgs.Arguments.Get(1)
Dim fnt As B4XFont = StubLabel.Font
For i = 2 To DesignerArgs.Arguments.Size - 1 Step 2
Dim text As String = DesignerArgs.Arguments.Get(i)
Dim tag As String = DesignerArgs.Arguments.Get(i + 1)
Dim lbl As B4XView = CreateLabel
lbl.Font = fnt
lbl.Text = text
lbl.TextColor = StubLabel.TextColor
lbl.SetTextAlignment("CENTER", "CENTER")
lbl.Tag = Array(DesignerArgs.LayoutModule, EventName, tag)
pnl.AddView(lbl, 0, 0, 40dip, pnl.Height)
Next
Else
For i = 0 To pnl.NumberOfViews - 1
pnl.GetView(i).Height = pnl.Height
Next
End If
End Sub
Private Sub CreateLabel As B4XView
Dim lbl As Label
lbl.Initialize("lbl")
Return lbl
End Sub
#if B4J
Private Sub lbl_MouseClicked (EventData As MouseEvent)
RaiseToolbarEvent(Sender, Sender.As(B4XView).Tag)
EventData.Consume
End Sub
#else
Private Sub lbl_Click
RaiseToolbarEvent(Sender, Sender.As(B4XView).Tag)
End Sub
#End If
Private Sub RaiseToolbarEvent (lbl As B4XView, Data() As Object)
CallSubDelayed2(Data(0), Data(1) & "_click", Data(2))
If ToolbarPressedColor <> 0 Then
lbl.SetColorAnimated(100, xui.Color_Transparent, ToolbarPressedColor)
Sleep(100)
lbl.SetColorAnimated(100, ToolbarPressedColor, xui.Color_Transparent)
End If
End Sub