Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Is there a way to change the default size in a multidevice app?


This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 11 - Last Post: Jun 13, 2017 12:43 PM Last Post By: Markus Humm
Edigest MCE

Posts: 19
Registered: 2/22/16
Is there a way to change the default size in a multidevice app?  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jun 9, 2017 8:41 AM
Hi,
I would like to use different font sizes according to the target device resolution; but I didn't find a way to use a "stylebook" to change the DEFAULT font size of all components.

Is there a way to do it?

Can I change only the font size of some components (for example change the default size of TText to 20, without changing the Style property of all TTexts) ?

Furthermore if I right click a TText control, I don't find the "Edit default style" item .... why?
Douglas Rudd

Posts: 314
Registered: 5/16/97
Re: Is there a way to change the default size in a multidevice app?  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jun 9, 2017 8:51 AM   in response to: Edigest MCE in response to: Edigest MCE
What's wrong with using TLabel instead of TText? TLabel does everything TText will do, doesn't it? And you can edit the default style and change the font size.
Edigest MCE

Posts: 19
Registered: 2/22/16
Re: Is there a way to change the default size in a multidevice app?  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jun 12, 2017 6:37 AM   in response to: Douglas Rudd in response to: Douglas Rudd
Douglas Rudd wrote:
What's wrong with using TLabel instead of TText? TLabel does everything TText will do, doesn't it? And you can edit the default style and change the font size.

What are the differences between them?

(I didn't find anywhere when to use TLabel and when to use TText)
Eli M

Posts: 1,346
Registered: 11/9/13
Re: Is there a way to change the default size in a multidevice app?  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jun 12, 2017 6:41 AM   in response to: Edigest MCE in response to: Edigest MCE
There are some differences. TLabel takes the Style. TText starts out with black text and doesn't take the style. This allows you to make changes to TText and they stick. With TLabel you have to change some other properties of the TLabel for your font customizations to show at runtime. TText also starts centered while TLabel starts left aligned. There may also be some word wrapping differences between the two.
Dave Nottage

Posts: 1,850
Registered: 1/7/00
Re: Is there a way to change the default size in a multidevice app?  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jun 9, 2017 2:18 PM   in response to: Edigest MCE in response to: Edigest MCE
Edigest MCE wrote:

Furthermore if I right click a TText control, I don't find the "Edit default style" item .... why?

Do it on a form, not a frame.

--
Dave Nottage [MVP, TeamB]
Find hints, tips and tricks at Delphi Worlds blog: http://www.delphiworlds.com
Edigest MCE

Posts: 19
Registered: 2/22/16
Re: Is there a way to change the default size in a multidevice app?  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jun 12, 2017 6:32 AM   in response to: Dave Nottage in response to: Dave Nottage
Dave Nottage wrote:
Edigest MCE wrote:
Furthermore if I right click a TText control, I don't find the "Edit default style" item .... why?

Do it on a form, not a frame.
Dave Nottage [MVP, TeamB]

I already tested it on a form: when I right click on a TText in a form there is no "Edit default style".
Jeremy North

Posts: 402
Registered: 9/20/99
Re: Is there a way to change the default size in a multidevice app?  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jun 12, 2017 6:28 PM   in response to: Dave Nottage in response to: Dave Nottage
Dave Nottage wrote:
Edigest MCE wrote:

Furthermore if I right click a TText control, I don't find the "Edit default style" item .... why?

Do it on a form, not a frame.

--
Dave Nottage [MVP, TeamB]
Find hints, tips and tricks at Delphi Worlds blog: http://www.delphiworlds.com

TText isn't style capable. It is a primitive.
Dave Nottage

Posts: 1,850
Registered: 1/7/00
Re: Is there a way to change the default size in a multidevice app?  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jun 13, 2017 2:09 AM   in response to: Jeremy North in response to: Jeremy North
Jeremy North wrote:

TText isn't style capable. It is a primitive.

Bummer

--
Dave Nottage [MVP, TeamB]
Find hints, tips and tricks at Delphi Worlds blog: http://www.delphiworlds.com
Markus Humm

Posts: 5,113
Registered: 11/9/03
Re: Is there a way to change the default size in a multidevice app?  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jun 13, 2017 12:43 PM   in response to: Dave Nottage in response to: Dave Nottage
Am 13.06.2017 um 11:09 schrieb Dave Nottage (TeamB):
Jeremy North wrote:

TText isn't style capable. It is a primitive.

Bummer

Why, if you have TLabel?
What does TText have that TLabel lacks?

Greetings

Markus
Eli M

Posts: 1,346
Registered: 11/9/13
Re: Is there a way to change the default size in a multidevice app?  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jun 12, 2017 6:44 AM   in response to: Edigest MCE in response to: Edigest MCE
There is code here which will let you change and override the Font app wide.

https://stackoverflow.com/questions/27023586/changing-default-textsettings-font-family-size-xe7

You can probably also do it with DuckDuckDelphi.

https://github.com/deadserious/duckduckdelphi
http://arcana.sivv.com/duckduckdelphi

You can also use a TScaledLayout. The reason to use a TScaledLayout is that the control inside which you change the font size won't change in size so it can cut off your new font (possibly).

http://docwiki.embarcadero.com/Libraries/Tokyo/en/FMX.Layouts.TScaledLayout
Edigest MCE

Posts: 19
Registered: 2/22/16
Re: Is there a way to change the default size in a multidevice app?  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jun 12, 2017 6:53 AM   in response to: Edigest MCE in response to: Edigest MCE
Edigest MCE wrote:
Hi,
I would like to use different font sizes according to the target device resolution; but I didn't find a way to use a "stylebook" to change the DEFAULT font size of all components.
Is there a way to do it?
Can I change only the font size of some components (for example change the default size of TText to 20, without changing the Style property of all TTexts) ?
Furthermore if I right click a TText control, I don't find the "Edit default style" item .... why?

If I use a TLabel; when I right-click and select "Edit default style" I get an Exception: "Cannot find style resource for Android"

[18F27E1C]{fmxstyledesigner250.bpl} FmxStyleController.TStyleController.PlatformToResourceName (Line 644, "FmxStyleController.pas" + 25) + $22
[18F278CA]{fmxstyledesigner250.bpl} FmxStyleController.TStyleController.CreateCustomStyle (Line 545, "FmxStyleController.pas" + 21) + $14
[18F28371]{fmxstyledesigner250.bpl} FmxStyleController.TStyleController.ChangePlatform (Line 745, "FmxStyleController.pas" + 28) + $2
[18F26D4B]{fmxstyledesigner250.bpl} FmxStyleController.TStyleController.Create (Line 250, "FmxStyleController.pas" + 35) + $D
[18F22EE7]{fmxstyledesigner250.bpl} FmxStyleWindow.TStyleWindow.Create (Line 66, "FmxStyleWindow.pas" + 2) + $11
[18F2FB21]{fmxstyledesigner250.bpl} FmxStyleEditors.DesignStyleBook (Line 80, "FmxStyleEditors.pas" + 2) + $F
[18F2FC80]{fmxstyledesigner250.bpl} FmxStyleEditors.TStyleBookEditor.Edit (Line 114, "FmxStyleEditors.pas" + 1) + $26
[0BD3892A]{fmxdesigner250.bpl} FmxSurface.TFmxDesignSurface.DoEditItemStyle (Line 5673, "FmxSurface.pas" + 18) + $5
[0BD38972]{fmxdesigner250.bpl} FmxSurface.TFmxDesignSurface.DoEditDefaultStyle (Line 5683, "FmxSurface.pas" + 0) + $2
[50BE517A]{vcl250.bpl } Vcl.Menus.TMenuItem.Click (Line 2541, "Vcl.Menus.pas" + 19) + $8
[50BE68C4]{vcl250.bpl } Vcl.Menus.TMenu.DispatchCommand (Line 3482, "Vcl.Menus.pas" + 5) + $4
[50BE7B66]{vcl250.bpl } Vcl.Menus.TPopupList.WndProc (Line 4655, "Vcl.Menus.pas" + 4) + $E
[50BE7AB5]{vcl250.bpl } Vcl.Menus.TPopupList.MainWndProc (Line 4630, "Vcl.Menus.pas" + 2) + $5
[5016E7EC]{rtl250.bpl } System.Classes.StdWndProc (Line 17363, "System.Classes.pas" + 11) + $2
[50C01907]{vcl250.bpl } Vcl.Forms.TApplication.ProcessMessage (Line 10607, "Vcl.Forms.pas" + 23) + $1
[50C0194A]{vcl250.bpl } Vcl.Forms.TApplication.HandleMessage (Line 10637, "Vcl.Forms.pas" + 1) + $4
[50C01C7D]{vcl250.bpl } Vcl.Forms.TApplication.Run (Line 10775, "Vcl.Forms.pas" + 26) + $3
Markus Humm

Posts: 5,113
Registered: 11/9/03
Re: Is there a way to change the default size in a multidevice app? [Edit]  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jun 12, 2017 12:59 PM   in response to: Edigest MCE in response to: Edigest MCE
Am 12.06.2017 um 15:53 schrieb Edigest MCE:
Edigest MCE wrote:
Hi,
I would like to use different font sizes according to the target device resolution; but I didn't find a way to use a "stylebook" to change the DEFAULT font size of all components.
Is there a way to do it?
Can I change only the font size of some components (for example change the default size of TText to 20, without changing the Style property of all TTexts) ?
Furthermore if I right click a TText control, I don't find the "Edit default style" item .... why?

If I use a TLabel; when I right-click and select "Edit default style" I get an Exception: "Cannot find style resource for Android"

[18F27E1C]{fmxstyledesigner250.bpl} FmxStyleController.TStyleController.PlatformToResourceName (Line 644, "FmxStyleController.pas" + 25) + $22
[18F278CA]{fmxstyledesigner250.bpl} FmxStyleController.TStyleController.CreateCustomStyle (Line 545, "FmxStyleController.pas" + 21) + $14
[18F28371]{fmxstyledesigner250.bpl} FmxStyleController.TStyleController.ChangePlatform (Line 745, "FmxStyleController.pas" + 28) + $2
[18F26D4B]{fmxstyledesigner250.bpl} FmxStyleController.TStyleController.Create (Line 250, "FmxStyleController.pas" + 35) + $D
[18F22EE7]{fmxstyledesigner250.bpl} FmxStyleWindow.TStyleWindow.Create (Line 66, "FmxStyleWindow.pas" + 2) + $11
[18F2FB21]{fmxstyledesigner250.bpl} FmxStyleEditors.DesignStyleBook (Line 80, "FmxStyleEditors.pas" + 2) + $F
[18F2FC80]{fmxstyledesigner250.bpl} FmxStyleEditors.TStyleBookEditor.Edit (Line 114, "FmxStyleEditors.pas" + 1) + $26
[0BD3892A]{fmxdesigner250.bpl} FmxSurface.TFmxDesignSurface.DoEditItemStyle (Line 5673, "FmxSurface.pas" + 18) + $5
[0BD38972]{fmxdesigner250.bpl} FmxSurface.TFmxDesignSurface.DoEditDefaultStyle (Line 5683, "FmxSurface.pas" + 0) + $2
[50BE517A]{vcl250.bpl } Vcl.Menus.TMenuItem.Click (Line 2541, "Vcl.Menus.pas" + 19) + $8
[50BE68C4]{vcl250.bpl } Vcl.Menus.TMenu.DispatchCommand (Line 3482, "Vcl.Menus.pas" + 5) + $4
[50BE7B66]{vcl250.bpl } Vcl.Menus.TPopupList.WndProc (Line 4655, "Vcl.Menus.pas" + 4) + $E
[50BE7AB5]{vcl250.bpl } Vcl.Menus.TPopupList.MainWndProc (Line 4630, "Vcl.Menus.pas" + 2) + $5
[5016E7EC]{rtl250.bpl } System.Classes.StdWndProc (Line 17363, "System.Classes.pas" + 11) + $2
[50C01907]{vcl250.bpl } Vcl.Forms.TApplication.ProcessMessage (Line 10607, "Vcl.Forms.pas" + 23) + $1
[50C0194A]{vcl250.bpl } Vcl.Forms.TApplication.HandleMessage (Line 10637, "Vcl.Forms.pas" + 1) + $4
[50C01C7D]{vcl250.bpl } Vcl.Forms.TApplication.Run (Line 10775, "Vcl.Forms.pas" + 26) + $3

Hello,

1. which version of Delphi?
2. does it happen as well when you drop a TStyleBook on your form,
connect this to your form and open the Android default style in this?
Then try to right click on the label and do your action. What happens?
3. You have most likely found some bug in Delphi. If you tried out 2. to
get more information about what works and what not you should report
your bug along with the callstack to quality.embarcadero.com if you
haven't already used the reporting facility the IDE usually shows you
when it crashes. Afterwards report the issue number here, so we can
follow it and discuss it there.

Greetings

Markus
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02