iOS Question Fontawesome icons in buttons

Status
Not open for further replies.

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.

B4X:
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
 

emexes

Expert
Licensed User
You should set the button's font to Font.CreateFontAwesome(17).

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).
 
Upvote 0

emexes

Expert
Licensed User
I just discovered and tried:
B4X:
UpButton.CustomLabel.Font = Font.CreateFontAwesome(37)
cleaned the project, recompiled and run, but... nope, still not getting icons.
 
Upvote 0

emexes

Expert
Licensed User
And using:
B4X:
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.
 
Upvote 0
Status
Not open for further replies.
Top