iOS Question Fontawesome icons in buttons

Discussion in 'iOS Questions' started by DickD, Jun 24, 2017.

Thread Status:
Not open for further replies.
  1. DickD

    DickD Active Member Licensed User

    I am trying to use the code below to create a button in a scrollview that was created in the designer. I simply want a button that is an open circle chr(0xF1DB). But when I run this code the button is a small, blue, square box with a question mark in it. I have tried other STYLEs with similar results. As you can see from the commented code I have also tried various combinations of Customlabel. Is there a tutorial or overview on icons in buttons and/or using CustomLabel in general. I could find nothing.

    Code:
    If QuestionArray.ButtonType(Row) = "Cbox" Then
    Btn(x).Initialize(
    "Cbox",Btn(x).STYLE_SYSTEM)
    'Btn(x).SetBorder(1, Colors.Black, 3)
    ' Btn(x).CustomLabel.font = Font.CreateNew(17)
    ' Btn(x).CustomLabel.TextColor = Colors.Green
    'Btn(x).Color = Colors.Red
    'Btn.Text = Text
    'Btn(x).Initializecustom("Cbox",Colors.black,Colors.green)
    'Btn(x).customlabel.text = Chr(0xF096)
    Btn(x).Text = Chr(0xF1DB)
    Btn(x).Tag = x
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    You should set the button's font to Font.CreateFontAwesome(17).
     
  3. emexes

    emexes Well-Known Member Licensed User

    I am having the same problem. FontAwesome icon characters look like this in Designer:

    upload_2019-5-6_17-16-20.png

    but this in running program:

    upload_2019-5-6_17-16-49.png

    The button font properties in Designer are:

    upload_2019-5-6_17-23-29.png

    and I cannot find a Font property to set from within the program per the solution given in the previous post:

    upload_2019-5-6_17-28-35.png

    which does seem mighty strange, thus I expect it will be embarrassingly obvious when you point it out to me :-/

    I am running B4i 5.30, and iOS 12.2 (recently updated re: Apple Developer two-factor security).
     
  4. emexes

    emexes Well-Known Member Licensed User

    I just discovered and tried:
    Code:
    UpButton.CustomLabel.Font = Font.CreateFontAwesome(37)
    cleaned the project, recompiled and run, but... nope, still not getting icons.
     
  5. emexes

    emexes Well-Known Member Licensed User

    And using:
    Code:
    Log(Asc(UpButton.Text.CharAt(0)))
    Log(Asc(UpButton.CustomLabel.Text.CharAt(0)))
    I've discovered that UpButton.CustomLabel.Text seems to refer to UpButton.Text, rather than being a separate variable.
     
  6. Erel

    Erel Administrator Staff Member Licensed User

    You should never post in old threads.

    An example is attached. No need to do anything special.
     

    Attached Files:

    • 1.zip
      File size:
      109.9 KB
      Views:
      24
    emexes likes this.
Thread Status:
Not open for further replies.
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