iOS Question B4XFloatTextField hint text font

davemorris

Active Member
Licensed User
Longtime User
Hi, Guys
I have a problem with B4XFloatTextField in B4i (B4A version is OK) - the font on the Hint text appears to be times roman, or something similar, and it don't fit in with the other text.

How can I change it?

Regards
Dave
 

davemorris

Active Member
Licensed User
Longtime User
Hi Erel
There appears no property in designed call HitFont - or have I miss it? - I have tried to change the Font property, in designer to something like DEFAULT-Italic and that only effects the Entered text not the hint text.

Regards
Dave
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
It should be there:

1595772607728.png
 
Upvote 0

davemorris

Active Member
Licensed User
Longtime User
Hi, Erel
Ok then (sorry about the basic question) what code goes on the RHS to select the font, so it the same as the normal font for entering text in this view. (Also remember for B4A the font used is OK)

B4X:
B4XFloatTextField1.HintFont = ?????

Kind regards
Dave
 
Upvote 0

davemorris

Active Member
Licensed User
Longtime User
Hi
In answer to your question - DEFAULT is selected.

It appears it don't matter what font I select - I tried DEFAULT-Italic and the hint text is still the same (appears to be something like times roman) - certainly not the same as the text when entering something into text box (which is Italic).



Regards
Dave
 
Upvote 0

angel_

Well-Known Member
Licensed User
Longtime User
It appears it don't matter what font I select - I tried DEFAULT-Italic and the hint text is still the same (appears to be something like times roman) - certainly not the same as the text when entering something into text box (which is Italic).
As Erel suggests, try to change by code
 
Upvote 0

Semen Matusovskiy

Well-Known Member
Licensed User
A problem in a library.
When user changes the properties (such as HintText, HintColor, HintFont), custom view should call subroutine "Update" with remark "'Call after changing the hint properties".

BTW, initial HintFont is really Times New Roman :) (<B4XFont: <UICTFont: 0x7fedaad44eb0> font-family: "Times New Roman"; font-weight: normal; font-style: normal; font-size: 18.00pt>)
 
Upvote 0

davemorris

Active Member
Licensed User
Longtime User
Hi
So we have got this far -

B4X:
B4XFloatTextField1.HintFont = ????? ' Need to know what ????? should be
B4XFloatTextField1.Update
I think I need to know how to specify the fonts - I can't find any documentation of a list of fonts and how to use them in an instruction (I can only find references to customized fonts) - their must be a simple way of doing it.


i.e. where do you find

(<B4XFont: <UICTFont: 0x7fedaad44eb0> font-family: "Times New Roman"; font-weight: normal; font-style: normal; font-size: 18.00pt>)

Regards
Dave
 
Upvote 0

Semen Matusovskiy

Well-Known Member
Licensed User
Take a look a directory, where B4i is installed (typically, C:\Program Files (x86)\Anywhere Software\B4i.
Inside a subdirectory Libraries you will find XUI Views.b4xlib. Copy this file somewhere outside, rename to .zip and extract B4xFloatTextField.bas
Rename B4xFloatTextField.bas to (for example) B4xFloatTextField2.bas

Create a new project and add B4xFloatTextField2.bas class. In Designer and in code use B4xFloatTextField2 instead of B4xFloatTextField.

Then search "HintFont" inside B4xFloatTextField2.bas and Log (HintFont) inside Public Sub Update subroutine, Theoretically it's possible to change HintFont and to call Update in own module, but it's not very comfortable
 
Upvote 0

davemorris

Active Member
Licensed User
Longtime User
Hi, Thanks for the response Semen

This post has changed from a problem with B4xFloatTextField to "how to select fonts" - it best I started new post about "how to select fonts".

Kind regards
Dave
 
Upvote 0

Semen Matusovskiy

Well-Known Member
Licensed User
I tested in IOS 13.6 simulators.
After small research I found that xui.CreateFont2 does something strange.
Font.CreateNew and xui.CreateDefaultFont work as expected (San-Francisco font)
But xui.CreateFont2 creates Times New Roman.

B4X:
    Dim HintFont1 As Font
    HintFont1 = Font.CreateNew (17)
  
    Dim HintFont2 As B4XFont
    HintFont2 = xui.CreateDefaultFont (17)
  
    Dim f1 As B4XFont =  xui.CreateFont2(HintFont1, 20)
    Dim f2 As B4XFont =  xui.CreateFont2(HintFont2, 20)
    Log ("HintFont1 = " & HintFont1)
    Log ("HintFont2 = " & HintFont2)
    Log ("f1 = " & f1)
    Log ("f2 = " & f2)

Results:
HintFont1 = <B4IFontWrapper: <UICTFont: 0x7faacac130f0> font-family: ".SFUI-Regular"; font-weight: normal; font-style: normal; font-size: 17.00pt>
HintFont2 = <B4XFont: <UICTFont: 0x7faacac130f0> font-family: ".SFUI-Regular"; font-weight: normal; font-style: normal; font-size: 17.00pt>
f1 = <B4XFont: <UICTFont: 0x7faacac20c90> font-family: "Times New Roman"; font-weight: normal; font-style: normal; font-size: 20.00pt>
f2 = <B4XFont: <UICTFont: 0x7faacac20c90> font-family: "Times New Roman"; font-weight: normal; font-style: normal; font-size: 20.00pt>
 
Upvote 0
Top