Android Question How to change text size in B4Xtable? (Solved)

A0_2_A7

Member
Licensed User
Hello, I am trying to change the text size in a B4Xtable and I do not know how to do it.

B4X:
B4XTable1.mBase.TextSize = 10

B4X:
Error occurred on line: 1350 (Info)
java.lang.RuntimeException: Type does not match (class anywheresoftware.b4a.BALayout)
    at anywheresoftware.b4a.objects.B4XViewWrapper.typeDoesNotMatch(B4XViewWrapper.java:361)
    at anywheresoftware.b4a.objects.B4XViewWrapper.asLabelWrapper(B4XViewWrapper.java:193)
    at anywheresoftware.b4a.objects.B4XViewWrapper.setTextSize(B4XViewWrapper.java:232)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:348)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:180)
    at anywheresoftware.b4a.debug.Debug.delegate(Debug.java:262)
    at b4a.example.info._crear_regalarmas(info.java:3356)
    at b4a.example.info._mqtt_messagearrived(info.java:4434)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:351)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
    at anywheresoftware.b4a.BA$2.run(BA.java:370)
    at android.os.Handler.handleCallback(Handler.java:873)

Any solution?
 

jimmyF

Active Member
Licensed User
Longtime User
In your B4XTable.Initialize sub, you might want to try this:

B4X:
Private Sub CreateCustomFormat (c As B4XTableColumn)
    Dim formatter As B4XFormatter
    formatter.Initialize
    c.Formatter = formatter
    Dim TextStyle As B4XFormatData = c.Formatter.NewFormatData
    TextStyle.TextColor = B4XTable1.TextColor
    TextStyle.TextColor = xui.Color_Black
    TextStyle.FormatFont = xui.CreateDefaultFont(16)
    c.Formatter.AddFormatData(TextStyle, 0, 0, True) 
End Sub
 
Upvote 0

A0_2_A7

Member
Licensed User
Column.Formatter is only relevant to numeric fields.

Add it before you set the data:
B4X:
B4XTable1.HeaderFont = xui.CreateDefaultBoldFont(30)
B4XTable1.LabelsFont = xui.CreateDefaultFont(10)

So it works perfectly, thank you very much.
 
Upvote 0
Top