Please be kind, I did my best with google, and found some guidance (also on StackOverflow), but none of it works for me.
FMX form with FMX Progressbar;
I only want to change the progressbar color from ugly yellow to cool skyBlue.
So far I've dropped a stylebook on the form;
I've added "progresscellstyle.htrack.hindicator" to the stylesheet designer;
It's the only one that even provides me with a color option (vs everything in "progressbarstyle treeitem") and that color does not influence my progressbar colour.
Please, a next step to decoding this problem if you could be so kind
Drop a TProgressBar on the form. Right click it and select Edit Custom Style. It should give you the style designer with a ProgressBar1Style1 object which contains htrack and vtrack.
htrack contains hindicator. Drop a TRectangle on the hindicator. Set the TRectangle to align Client. Change the Fill color as desired. Change the Stroke Kind to None.
vtrack contains vindicator. Drop a TRectangle on the vindicator. Set the TRectangle to align Client. Change the Fill color as desired. Change the Stroke Kind to None.
Close the style designer and save when it asks. This is one way to do it.
This may be a title old question, but the content about this is so rare that I think will be useful to future generations to have some info here.
To simply put, to change the color that will fill your bar you have to select a area in your BitmapLinks. To do that double click in the SourceLink property in the hindicator (a child of htrack in the tree view).
Then select a are that you will want to use as the filling, if none of the option pleases you, you may add a new BitMap to your StyleBook.
For the background color, just insert a rectangle inside htrack with a Client Alignment
Related
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'm using TRectangle's for buttons on an FMX app, unfortunately, there's no property setting for TouchTargetExpansion like there's in most styled-components.
What is the way to get it on basic components such as TRectangle?
Another option that I used a lot is to add a TRectangle with fill color null over text and controls. Then you control the click area using this invisible rectangle. That way you can forget about the Touchtargetexpansion option and use this "invisible touch rectangle" on any area or component.
In my Delphi VCL Form Application I have to change the background color of a TButton.
Is there a way to apply this change without using a third-party components?
Thanks.
You can't change the color of a TButton component directly, instead you must use a third-party component or owner draw the button (BS_OWNERDRAW).
Create a panel.
Change panel's color to any color.
Empty panel's caption.
Create a SpeedButton inside the panel.
Set SpeedButton's Flat property True.
Set SpeedButton's Align propert alClient.
Voila! Here is your button with color!
Original source: https://engineertips.wordpress.com/2020/07/21/delphi-button-background-color/
Nice tip, thank you, Xel Naga!
You can also place an image on the panel, to make your button even nicer.
Here I’ve added an image of a Yellow- Glass- button.
To get the rounded corners, you shape the panel like this >>
SetWindowRgn(Panel1.Handle, CreateRoundRectRgn(0, 0, Panel1.Width, Panel1.Height, 65, 40), True);
Next level after that, you can add 3 more images (on top of each-other) for button states: Mouse Over (OnMouseEnter), Button Pressed (OnMouseDown) and Button Disabled. Just change the Visible state of the images to reveal the one you want to see...
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
There seems to be not much information available about this subject so hopefully someone can give some suggestions.
I would like to change color and style of different parts of text in a stringgrid cell.
Example:
20-02-2011 - Document Title
Would it also be possible to show an icon in a stringgrid cell?
It is indeed possible to show icons or bitmaps in a string grid, the Monkey Styler blog includes an example of how to customise cell display in a FMX grid.
http://monkeystyler.com/blog/entry/firemonkey-grid-basics-custom-cells-and-columns
Thinking about the other part of your question though, you will have to build a style up to display text in different fonts, as yet FMX does not have a richtext equivalent or HTML rendering components (I'm sure the latter will come, the former I am not confident on getting for a while!). You would have to have a text component in the style for each different font size/style etc, you would need to name the text elements (using binding or stylename properties) and handle the setting of the text contents using code in the ongetvalue and onsetvalue events (I guess you could also use a onapplystyle event) to display some text in bold and some not.
The event handler would then use either a binding - which is easier to set but - in my experience - buggy;
mycell.binding['boldtext']:='sometext';
Or find a style element by stylename by using findstyleresource;
tempobj:=mycell.findstyleresource('boldtext');
if tempobj is ttext then
ttext(tempobj).text='sometext';
Excuse any bad coding style there, but you get the general idea (I hope) if you set autosize to true for the ttext components in the style and align them left you get - mostly - what you are after. The only issue is that the resulting text doesn't look quite seamless because autosizing and aligning left doesn't really give you the same space between the fonts that you would get with a richtext or HTML display. You should be able to fiddle with the padding (giving it a negative number for the left padding should allow you to remove any extra space) but you have to live with that not being entirely perfect compared to proper font hinting and alignment.