Setting fonts in Firemonkey - delphi

Is there a way to set font properties in the firemonkey style editor?
I tried both using a custom style and changing the default style of a TButton.
Each of these layouts have a child TText component which is named text. If I try to change the font settings (e.g. change the bold flag) it looks okay in the designer, but in the form designer as well as at runtime, nothing changes.
Is there also a way to define a default font for all TTextControls? In vcl there is a parentfont property which is not available in Firemonkey. After a closer look to the components code, I think it should be possible by defining the text layout for a TTextControl in the stylebook. But this component is not registered in the component palette.
Update: TMenuItem does not apply font settings at all. At the moment it can only be done at runtime.

This was fixed in XE 2 Update Pack 1. Try downloading the new version. You can now set Font styles.

Related

How to change color of the scrollbar in SynMemo with VCL styles

there. I changed style of standard objects with VCl-theme.
I use Color, Font and Gutter properties to change style of SynMemo. But I don't know, how change style of ScrollBar of SynEdit( apply vcl-theme ). Who can help me ?
To add styling support for the TSynEdit you must register a style hook for such control. Try using the TScrollingStyleHook style hook.
Like so
TStyleManager.Engine.RegisterStyleHook(TCustomSynEdit, TScrollingStyleHook);

Can't see and use custom VCL style

I created a new style in the Bitmap Style Designer, saved it in the Styles folder, but I can't see it in the project options under the Appearances tab. What's wrong?
If you use an Embarcadero supplyed style as basis, you need to change Author and Name fields in the designers Inspector window.
Then your style will be listed in Project Options - Appearance under an own divider line:

How do I use a button duplicated in my style in FireMonkey?

I've created a style with the Bitmap Style Designer for Delphi XE7.
I've updated the button style to white with a blue border and duplicated it to create an orange button called Button_Copy.
I've exported the style to FireMonkey, but I can't find Button_Copy to assign it to a button on my form. How do I do this?
Also, can I rename Button_Copy to e.g. OrangeButton?
In the Bitmap Style Designer, save the style as a FireMonkey style.
Add a TStyleBook to your form.
Set the StyleBook property to the stylebook.
Double-Click the StyleBook and open your style. Close and Apply.
You can now set the StyleLookup property of a button to Button_Copy and if all is well you will see your new style.
Note that your new style won't appear in the selection list for StyleLookup - the list of available values appears to be hard coded.
And, of course you can change the name - just change the StyleName property of the top level object (probably a TLayout). The normalnaming convention is to append the word 'style', e.g. OrangeButtonStyle.

How to change caption font color on TCheckBox, TRadioButton, TGroupBox?

I don't know what my problem is, but I cannot set the font color in DEx2 for controls like TCheckBox, TRadioButton, TGroubBox, and TRadioGroup. It doesn't matter if I do it in the IDE or programmatically.
I have set my form color to clBlack and want my captions to be clWhite, but they won't render any color but clBlack. When I assign a color on a form's OnShow event and step through it in the debugger, it shows the value I assigned it, but on the screen it is still black.
I am not using styles or anything else. Any ideas?
Here is a sample form:
white on black example http://www.skippix.us/temp/Delphi-Font-Problem.bmp
When you uses the windows themes in an application, most of the custom settings like the font colors are ignored. As workaround and depending of the component you can ownerdraw the control (only when this feature is supported), override the paint method in order to use your own color in the font (TRadioGroup, TGroupBox), and for components like TCheckBox and TRadioButton (which are WinAPI controls wrappers) you must intercept the WM_PAINT windows message and implement your own code to draw the control.
Also starting with Delphi-xe2 you can use the vcl styles which allow you to change the appearance of the controls, from here (and when is possible) you can modify the style hooks to apply your own font colors and other customizations.
A simple and easier workaround is to create a checkbox without caption and add a label after it. You can easily change the label's color. You can also create a new component that binds a label to the checkbox itself. That's what worked for me on Delphi 2007.
It will work under the following setting:
Project Options > Application > Runtime Themes = none

Styling a menubar item (Firemonkey)

I can't seem to figure out how to change the font of a tmenuitem object.
I add a menubar, and add a item to it.
I create a customstyle for the menuitem.
I can change the background color and stroke color etc,etc, but I can NOT change the font of the text part.
If I change the font (size or name or anything) it shows in the style editor but does not show in the form designer or at runtime.
Seems the font somehow default to something.
Has anyone else been able to do this ?
FireMonkey overwrites pretty much any settings you make for fonts (face, size, style) within a style. AFAIK any font changes you want to make have to be done at run time. In the case of a TMenuItem that means by setting the Font property manually after you have created the menu item.
However (and I've never played with this) I seen people saying they can change a font by setting the StyleLookup after a component has been created.
You might want to hook into the OnApplyStyleLookup event to make these updates.

Resources