Android Question B4XComboBox text properties not read from designer

Alessandro71

Well-Known Member
Licensed User
Longtime User
Text properties set in the designed are not used in B4XComboBox
Any workaround to set them programmatically?
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Moved to the questions forum.

B4XComboBox is based on Spinner in B4A. The font cannot be simply set.

The designer text properties are used in B4XComboBox where possible:
B4X:
Public Sub DesignerCreateView (Base As Object, Lbl As Label, Props As Map)
    mBase = Base
    Tag = mBase.Tag : mBase.Tag = Me
    Dim xlbl As B4XView = Lbl
#if B4J
    cmbBox.Initialize("cmbBox")
    Dim xbox As B4XView = cmbBox
    xbox.Font = xlbl.Font
    mBase.AddView(cmbBox, 0, 0, mBase.Width, mBase.Height)
#Else If B4A
    cmbBox.Initialize("cmbBox")
    cmbBox.TextSize = xlbl.TextSize
    mBase.AddView(cmbBox, 0, 0, mBase.Width, mBase.Height)
#Else If B4i
    Dim btn As Button
    btn.Initialize("btn", btn.STYLE_SYSTEM)
    mBtn = btn
    mBtn.Font = xlbl.Font
    mBase.AddView(mBtn, 0, 0, mBase.Width, mBase.Height)
#End If
End Sub
In B4A only the text size is used. In B4J and B4i the font is also set.

You can pass CSBuilders instead of strings to change the font.
 
Upvote 0
Top