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

Discussion in 'Android Questions' started by A0_2_A7, May 8, 2019.

  1. A0_2_A7

    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.

    Code:
    B4XTable1.mBase.TextSize = 10
    Code:
    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?
     
  2. jimmyF

    jimmyF Active Member Licensed User

    In your B4XTable.Initialize sub, you might want to try this:

    Code:
    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, 
    00True
    End Sub
     
    A0_2_A7 likes this.
  3. Erel

    Erel Administrator Staff Member Licensed User

    Column.Formatter is only relevant to numeric fields.

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

    A0_2_A7 Member Licensed User

    So it works perfectly, thank you very much.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice