Buttonlabel/Textfield Size of text on Tablet is different
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Buttonlabel/Textfield Size of text on Tablet is different
Hi
I need help once again
Why is the size of text in Livecode like this
and in Tablet like this
Is this a different font? Do the tablet do not use the font from livecode?
Texter
I need help once again
Why is the size of text in Livecode like this
and in Tablet like this
Is this a different font? Do the tablet do not use the font from livecode?
Texter
-
- VIP Livecode Opensource Backer
- Posts: 7237
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: Buttonlabel/Textfield Size of text on Tablet is different
If you have not assigned a font to the stack or to individual controls, LC uses the system font which is different on every OS. If you did assign a font and the OS doesn't have that font, then it also falls back to the system font.
You can either assign a font that exists on all platforms (there are only a few) or include the font file with the app. See "start using" in the dictionary.
You can either assign a font that exists on all platforms (there are only a few) or include the font file with the app. See "start using" in the dictionary.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: Buttonlabel/Textfield Size of text on Tablet is different
As well as what Jacque pointed out, different OSes display the same fonts differently to some degree (i.e. Mac/Windows/Linux, not sure about mobile), so even using those same few fonts may not give you exactly the same appearance, requiring you to make sure the final appearance is correct on the devices OS.
Re: Buttonlabel/Textfield Size of text on Tablet is different
Hi
Thanks jacque and bogs
I will search which fonts are equal to livecode on Win10 and Android.
But is there a code to use this font for the whole stack? Or do I have to set this font to all fields and labels?
Texter
Thanks jacque and bogs
I will search which fonts are equal to livecode on Win10 and Android.
But is there a code to use this font for the whole stack? Or do I have to set this font to all fields and labels?
Texter
Re: Buttonlabel/Textfield Size of text on Tablet is different
Hi Texter,
the magic word is "inheritance", no code needed!
If you set the textfont (or any other property) for a stack and
not for every card and objects, then all cards and object "inherit"
this textfont property. This applies to ALL properties!
So if you did not set the textfont explicitely for any card or control,
just set it for the stack and you are done!
Best
Klaus
the magic word is "inheritance", no code needed!
If you set the textfont (or any other property) for a stack and
not for every card and objects, then all cards and object "inherit"
this textfont property. This applies to ALL properties!
So if you did not set the textfont explicitely for any card or control,
just set it for the stack and you are done!
Best
Klaus
Re: Buttonlabel/Textfield Size of text on Tablet is different
Hi Klaus,
Thanks for all your help.
I managed it to set the textfont for the whole stack.
Can I also set the textfont for all fields (only fields) of the stack?
I tried it but get only Errors. How is the syntax for this?
Texter
Thanks for all your help.
I managed it to set the textfont for the whole stack.
Can I also set the textfont for all fields (only fields) of the stack?
I tried it but get only Errors. How is the syntax for this?
Texter
Re: Buttonlabel/Textfield Size of text on Tablet is different
Hi Texter,
of course you can set the textfont (and any property!) for each control in LC separately.
That will overwrite the inherited property.
To do so for all fields in your stack you need to script a nested repeat loop like:
Best
Klaus
of course you can set the textfont (and any property!) for each control in LC separately.
That will overwrite the inherited property.
To do so for all fields in your stack you need to script a nested repeat loop like:
Code: Select all
...
lock screen
put "Comic Sans OH NO!" into tFont
repeat with i = 1 to the num of cds
put the num of flds of cd i into tFields
repeat with k = 1 to tFields
set the textfont of fld k of cd i to tFont
end repeat
end repeat
unlock screen
...
Klaus
-
- VIP Livecode Opensource Backer
- Posts: 2718
- Joined: Sat Dec 22, 2007 5:35 pm
- Location: Genève
- Contact:
Re: Buttonlabel/Textfield Size of text on Tablet is different
Hi Texter,
Best regards
Jean-Marc
Yes, something like that:Can I also set the textfont for all fields (only fields) of the stack?
Code: Select all
on doChangeMyFont pFont
set the lockmessages to true
lock screen
repeat with i = 1 to the num of cds
open cd i
repeat with z = 1 to the num of flds
set the textFont of char 1 to -1 of fld z to pFont
end repeat
end repeat
open cd 1
end doChangeMyFont
Jean-Marc
https://alternatic.ch
-
- VIP Livecode Opensource Backer
- Posts: 7237
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: Buttonlabel/Textfield Size of text on Tablet is different
There's a difference between setting the font of a field and setting it for the characters in the field. The first applies to any text, whether new or not, and the latter applies only to the current text. If is deleted and replaced, it will use the font inherited from a control farther along the hierarchy.
Inheritance goes from character text, field, card, stack. The first one that has the property set is the setting that's used.
Inheritance goes from character text, field, card, stack. The first one that has the property set is the setting that's used.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: Buttonlabel/Textfield Size of text on Tablet is different
Hi Klaus, Jean-Marc, Jacque
Thank you for your help
Thought it is easier to set the textfont because set the textfont of stack "Test" to "Arial" worked fine.
and I tried set the textfont of all fields of stack "Test" to "Arial"
Never imagine I need a loop for this
Texter
Thank you for your help
Thought it is easier to set the textfont because set the textfont of stack "Test" to "Arial" worked fine.
and I tried set the textfont of all fields of stack "Test" to "Arial"
Never imagine I need a loop for this
Texter
-
- VIP Livecode Opensource Backer
- Posts: 7237
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: Buttonlabel/Textfield Size of text on Tablet is different
You can shift-click all the fields on a card using the edit tool, then double-click any one of them to open the property inspector. In the text pane (looks like an "A") you can select the font and size and it will be applied to all the selected objects. Unless you need to change fonts dynamically in script, you only need to do this once during development.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: Buttonlabel/Textfield Size of text on Tablet is different
As you might imagine, depending on your ultimate goals, there are a few ways to tackle what your describing. All of the above will do what you asked about, in particular to expound on Klaus's answer to this:
None of the above requires any coding, although there is certainly nothing wrong with the loops described above, I save those for cases where I can't achieve my goals through layout. For example, as Jacque mentioned, if you needed to change text dynamically in one (or more) field(s), or if you needed to change the color of one (or more) button(s), then using case/select (for a few controls) or a loop for a large number of controls becomes a more viable option.
Here is a picture with the defaults in place and 3 controls. Once you set the text formatting of the stack, all of the controls automatically inherit that as Klaus pointed out, as well as any new controls you add. The exception will be the Title bar for the window, it will have the font and the size is determined by the OS setting. Next, let us say that you wanted to make the field text bold, but retain the font of the stack. Clicking on the control, in the text formatting area, simply click on bold. When I am setting up my design, I normally just drag one of each control out and make sure it looks how I think it should, then if I need more of that control, I ctrl/click/drag it to where it is needed, or copy/paste it, however if you wanted something like that you could just make a template control with the changes desired as well.
None of the above requires any coding, although there is certainly nothing wrong with the loops described above, I save those for cases where I can't achieve my goals through layout. For example, as Jacque mentioned, if you needed to change text dynamically in one (or more) field(s), or if you needed to change the color of one (or more) button(s), then using case/select (for a few controls) or a loop for a large number of controls becomes a more viable option.
You may also want to look up childControl in the dictionary, in using loops this will allow you to target specific types of controls instead of looping through all the controls on a card or in a group, the output will give you the short name or ids.