B4A Class [B4X] [XUI] AutoTextSizeLabel

Discussion in 'Additional libraries, classes and official updates' started by Alexander Stolte, Dec 7, 2018.

  1. Alexander Stolte

    Alexander Stolte Well-Known Member Licensed User

    It is not recommented to use this class in B4J, the textsize is resetting without reasons...

    this class is based on the Original Class from @Erel.
    It works on B4A, B4I and B4J.
    I tested it with B4A and B4I.

    IMG_0064 (2).jpg Screenshot_20181207-150129__01 (1).jpg

    Notes:
    -XUI is needed

    Change log:
    - V1.0
    • Release
    - V1.1
    • Add RefreshView
    • Add BaseLabel to get the base view, to change view properties
    - V1.2
    • BugFix TextSize in B4A on single line was buggy
    • Add Click Event (B4A and B4I only)
    • Add LongClick Event (B4A and B4I only)
    Have Fun
    Alex
     

    Attached Files:

    Last edited: Jan 17, 2019
  2. iCAB

    iCAB Well-Known Member Licensed User

    Hi Alexander

    Did you try testing it with with a short Label, say half the height of the left label containing "Two Words", with Text = "ONE".
    I tried that and the "ONE" seems to be cutoff

    Thanks
    iCAB
     
  3. Alexander Stolte

    Alexander Stolte Well-Known Member Licensed User

    New Update

    - V1.2
    • BugFix TextSize in B4A on single line was buggy
    • Add Click Event (B4A and B4I only)
    • Add LongClick Event (B4A and B4I only)
     
    iCAB and jimmyF like this.
  4. rraswisak

    rraswisak Member Licensed User

    Hi @Alexander Stolte

    The label text size is working for me in B4J, the change i made is:

    Code:
    Public Sub setText(value As Object)
       Sleep(
    0)
       mlbl.Text = value
       
    Dim multipleLines As Boolean = mlbl.Text.Contains(CRLF)
       
    Dim size, newSize As Float
       
    For size = 2 To 80
           newSize = size
           
    If CheckSize(size, multipleLines) Then Exit
       
    Next
       
    'mlbl.TextSize = newSize '<--- replace with line below
       CSSUtils.SetStyleProperty(mlbl,"-fx-font-size",newSize-2)
       
    Log(size)
       
    Log(mlbl.TextSize)
    End Sub
     
    Last edited: Feb 19, 2019
    Alexander Stolte likes this.
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