Are there special steps for styling a button using stylebook in FMX? because whenever I change my style it works in the viewer only, however when I run the program nothing changes although stylebook setting are properly connected to style files and to the application as well, also if I close the program and start it again I find the same style saved and exists in the view but when run the application I cant find any style, can anyone tell me the exact steps? because I check tutorials, docs, help but still stylebook wont apply the new changes to the app at run time. Thanks.
Screenshot
To modify the default style:
Start with a blank fmx form and add a TButton.
Right-Click on the button and select Edit Default Style ... - the Style Designer opens
In the Structure pane select Buttonstyle - text
In the Object Inspector change the NormalColor property to Crimson. The text of the button changes to Crimson (red) color.
Hit the designer view Close button (X) and confirm to Apply changes ... by clicling Yes when prompted. Note that a Stylebook has been added to the form.
Build and run
The result looks like this on Windows 7
Maybe you have omitted step 5 (just guessing)
With an existing stylebook and style do as follows:
Start with a blank fmx form and add a TButton.
Add a TStyleBook, set its UseStyleManager property, double-click it and load an existing style (e.g. Air)
In the structure pane select buttonstyle - text. Note that available properties are not necessarily the same as when editing the default style.
In the Object Inspector change the Font - FontColor property to Yellow. The text of the button changes to yellow color.
Hit the designer view Close button (X) and confirm to Apply changes ... by clicling Yes when prompted.
Build and run
The result looks like this on Windows 7
Related
I am using DevExpress TdxBarManager for Delphi, which is very complex component. It contains set of TdxBarButton's (or its descendants) - commands. And it also contains set of TdxBars - panels in which those commands are placed.
During the design time the developer creates TdxBarButton instance, assings properties to it in the object inspector and then drags-and-drops it on the TdxBar instance.
During the runtime the user can call 'Add or Remove Buttons' and this opens the dialog, in which the user can opt to make some buttons from this bar invisible. The visible/invisible button selection is preserved in the user registry.
My question is - how can I press the TdxBarButton to be always visible? Even when the user has opted to make it invisible. I know that dxBarButton has Visible property whose possible values include ivAlways, but this value ir preserved and resetting it does not make the invisible button visible again.
I am currently developing using Delphi 6, but I guess the same applies to TdxBarManager in the more recent Delphi as well like Delphi 2009 or Delphi Sydney.
I am trying to add a fade-out effect to a TMemo control.
In the Form Designer it works quite well with a TLayout, TRectangle, and TMaskToAlphaEffect, as show in the screenshot on the left side. However, I would like to use the Style Designer (TStyleBook), as this seems the predestined approach and offers even more possibilities.
I have recreated it in the Style Designer, and in the Form Designer it looks as expected.
At runtime, however, the fade-out effect is not visible for TMemo styled by the TStyleBook. The "manually" styled TMemo is working fine.
As the Windows resources for the TStyleBook generates a ~83kb .fmx file, I had to upload the MCVE, which can be found on DropBox.
To do it on your own, follow these steps:
Open new FMX project
Add a TMemo to the form
Right click the TMemo and select "Edit Custom Stlyes..."
Select "background" under Memo1Style1 in the structure panel
Add a TRectangle from the component palette by double clicking
Select the Rectange1Style and change
Align to "Client"
Fill -> Kind to "Gradient"
Add a TMaskToAlphaEffect as child from the component palette by double clicking (Rectange1Style still selected)
Close the Style Designer and confirm applying the changes
If I change the Z-order of the TRectangle in the Style Designer, the effect also disappears in the Form Designer.
Am I missing something, or is it due to an incorrect Z-order at runtime, or is my approach fundamentally wrong?
I have a TActionToolbar...But there's one "feature" I can't quite figure out how to control.
From the customize dialog (Vcl.CustomizeDlg.TCustomizeDlg) for a TActionToolbar. Note the caption options listbox:
So how exactly do you use selective captions? Right now it appears to be identical to "full" captions, as I can't seem to piece together how you tell Delphi which buttons should display selective captions (or what the selective caption wording should be if it is customizable)
TAction doesn't seem to have any properties that appear to relate to selective captions. The description and examples for TCaption didn't seem to get any hints either.
...Or is this just one of those cases where Delphi is showing some sort of standard windows dialog including features Delphi doesn't actually support?
So how exactly do you use selective captions?
As the same suggests it, it allows to have some buttons showing their caption and some others to don't show it.
Once you've set the action in your toolbar, click on the button. Then go in the inspector and go to the property "ShowCaption" and set it to false. For each button you will do that, the caption will be hidden.
I will try to place a graphic here showing that.
1-click the tool button
2-go to the object inspector
3-see the "ShowCaption" property and set it to "false"
4-then see the result, the first button is now showing its caption
I use that from time to time to gain some space on a toolbar with too much button to hide the caption on some obvious button.
Trying to get a new style on a ComboBox in FireMonkey (XE2).
But for some odd reason I cannot get the text of a ListBoxItem to show.
What I've tried is the following.
Create a new FireMonkey HD Application.
On the form I've added a ComboBox.
Right click on the ComboBox and select 'Edit custom style'
There I've added the following components
while the original one consist out of the following components
Now it seems to me that I need the TContent object (but I can't seem to find it in the toolpallete)
How can i bind my Text object to the strings that are placed in my ComboBox?
Any pointers are very welcome.
FireMonkey doesn't use a TText object to display the text. Instead it creates a copy of the list box item within the TContent (if I remember correctly).
As you've worked out you need to add a TContent to your form. The easy way to do this is to
go back to the form,
right click and select View as Text
Find the TStyleBook object and add a TContent at the appropriate point (the format for this should be obvious from the rest of the file).
No need to add any properties - defaults will be used the first time.
Right click, View as Form.
Go back into the style editor and edit away.
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.