Watch, Follow, &
Connect with Us

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


Welcome, Guest
Guest Settings
Help

Thread: overriding Themes



Permlink Replies: 8 - Last Post: Sep 12, 2014 5:18 AM Last Post By: stephen lukacs
stephen lukacs

Posts: 13
Registered: 6/18/12
overriding Themes
Click to report abuse...   Click to reply to this thread Reply
  Posted: Aug 26, 2014 1:23 PM
hello one and all,

themes are nice, aqua twilight is pretty. but sometimes i signal to the user different states. like how do i override font.color for TLabel? or, how do i change the color of TEdit? because when i set these properties at runtime in code, the theme ignores the changes and keeps it all under the theme.

lucas
Tom Brunberg

Posts: 329
Registered: 12/27/04
Re: overriding Themes
Click to report abuse...   Click to reply to this thread Reply
  Posted: Aug 26, 2014 11:27 PM   in response to: stephen lukacs in response to: stephen lukacs
stephen lukacs wrote:

hello one and all,

themes are nice, aqua twilight is pretty. but sometimes i signal to the user different states.
like how do i override font.color for TLabel? or, how do i change the color of TEdit? because
when i set these properties at runtime in code, the theme ignores the changes and keeps it all
under the theme.

lucas

By removing the setting you want to change from the StyledSettings property:
e.g.
  Label1.StyledSettings := Label1.StyledSettings - [FontColor];


--
Tom Brunberg
firstname.lastname@welho.com
Tom Brunberg

Posts: 329
Registered: 12/27/04
Re: overriding Themes
Click to report abuse...   Click to reply to this thread Reply
  Posted: Aug 27, 2014 12:57 AM   in response to: Tom Brunberg in response to: Tom Brunberg
Tom Brunberg wrote:

stephen lukacs wrote:

hello one and all,

themes are nice, aqua twilight is pretty. but sometimes i signal to the user different states.
like how do i override font.color for TLabel? or, how do i change the color of TEdit? because
when i set these properties at runtime in code, the theme ignores the changes and keeps it all
under the theme.

lucas

By removing the setting you want to change from the StyledSettings property:
e.g.
  Label1.StyledSettings := Label1.StyledSettings - [FontColor];

Correction, addition:
The above is for FMX labels, I just realized that you are asking for a VCL label.
In VCL the setting to change is StyleElements, untick the seFont to false in the designer or in
code:
  Label1.StyleElements := Label1.StyleElements - [seFont];

--
Tom Brunberg
firstname.lastname@welho.com

stephen lukacs

Posts: 13
Registered: 6/18/12
Re: overriding Themes
Click to report abuse...   Click to reply to this thread Reply
  Posted: Sep 9, 2014 2:42 AM   in response to: Tom Brunberg in response to: Tom Brunberg
  Label1.StyleElements := Label1.StyleElements - [seFont];

ok, can you do a subproperty, like seFont.seColor?

thanx lucas
stephen lukacs

Posts: 13
Registered: 6/18/12
Re: overriding Themes
Click to report abuse...   Click to reply to this thread Reply
  Posted: Sep 9, 2014 2:58 AM   in response to: Tom Brunberg in response to: Tom Brunberg
  Label1.StyleElements := Label1.StyleElements - [seFont];

what unit is this property StyleElements? because i search for it in the help file and it doesn't come up.

what topic is best read to get an overview and examples of how to use these themes?

thanx in advance, lucas
Tom Brunberg

Posts: 329
Registered: 12/27/04
Re: overriding Themes
Click to report abuse...   Click to reply to this thread Reply
  Posted: Sep 9, 2014 3:16 AM   in response to: stephen lukacs in response to: stephen lukacs
stephen lukacs wrote:

  Label1.StyleElements := Label1.StyleElements - [seFont];

what unit is this property StyleElements? because i search for it in the help file and it
doesn't come up.

what topic is best read to get an overview and examples of how to use these themes?

thanx in advance, lucas

Hi Stephen,

Styleelements is a property of TControl (and therefore all descendants):


definition:


You may find this useful:


To answer your question in your previous post:
No, there is no such thing as seFont.seColor (or similar).
To change the color you need to set e.g.
  Label1.Font.Color := clRed;

as normally when you set the color of a label.
The point was to disable the StyleElement seFont, in order to override the style.

--
Tom Brunberg
firstname.lastname@welho.com

stephen lukacs

Posts: 13
Registered: 6/18/12
Re: overriding Themes
Click to report abuse...   Click to reply to this thread Reply
  Posted: Sep 11, 2014 4:48 AM   in response to: Tom Brunberg in response to: Tom Brunberg
hmm?

here is my compile time error:

[DCC Error] prm0Chs0.pas(78): E2003 Undeclared identifier: 'StyleElements'

here is my uses clause:

uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Menus, ExtCtrls, DBCtrls, DB, DBTables, StdCtrls, Grids, DBGrids,
MDODatabase, MDOCustomDataset, prm1Nav0;

and here is a code snippet:

for i := 0 to Pred(self.ControlCount) do
if ((Controls[i] is TLabel) and (TLabel(Controls[i]).Tag > 0)) then
TLabel(Controls[i]).StyleElements := TLabel(Controls[i]).StyleElements - [seFont];

where the last line is where the error is being raised twice.

AND, i looked in the Vcl.Controls and searched for StyleElements and there is no such reference. there is the property

property ControlStyle: TControlStyle read FControlStyle write FControlStyle;

under TControl but not StyleElements. so still confused.

thanx in advance, lucas
Olivier Sannier

Posts: 424
Registered: 8/26/01
Re: overriding Themes
Click to report abuse...   Click to reply to this thread Reply
  Posted: Sep 11, 2014 5:45 AM   in response to: stephen lukacs in response to: stephen lukacs
stephen lukacs wrote:
hmm?

here is my compile time error:

[DCC Error] prm0Chs0.pas(78): E2003 Undeclared identifier: 'StyleElements'

This property was introduced with Delphi XE3
stephen lukacs

Posts: 13
Registered: 6/18/12
Re: overriding Themes
Click to report abuse...   Click to reply to this thread Reply
  Posted: Sep 12, 2014 5:18 AM   in response to: Olivier Sannier in response to: Olivier Sannier
OMG, i have XE2. so how do i do it in XE2?
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02