VirtualTreeView and VCL Styles - delphi

i'm using VirtualTreeView (as a grid - in Delphi XE7) in my app and i also chose to use the Carbon VCL style.
The problem arise because i need to color some rows according some status on each line, and the font color keep staying white even when i use a light color on a line. So it is impossible to read the data. When i use the Iceberg Classico style, this issue do not occurs.
So basically, i can change my set of rows color according to the style selected, it is one solution. But i'm looking for a way to modify the font color according to the row color background?
I'm doing the colorization code inside the event: BeforeCellPaint and i tried to modify the font color without any success.
Any idea?

i found a library that helps a lot on this subject:
// unit for the VCL Styles Utils
// github.com/RRUZ/vcl-styles-utils
TargetCanvas.Brush.Color := aColor;
if TStyleManager.ActiveStyle.Name = 'Carbon' then
TCustomStyleExt(TStyleManager.ActiveStyle).SetStyleFontColor(sfTreeItemTextNorma‌​l, clBlack)
else
TCustomStyleExt(TStyleManager.ActiveStyle).SetStyleFontColor(sfTreeItemTextNorma‌​l, aFontColor);
TargetCanvas.FillRect(CellRect);
With this i can change the font color.
Laurent

Related

Can I change skin colors without using bitmaps?

In Bitmap Style manager when I need to change form client area or borders I have to select it from the Bitmap property left click + right click then apply. But I want to ask is there a way to change colors from the Color property instead ? or everything must be bitmaps
i am using RAD 10.3.3
you can find on TForm properties.
on VCL
Color = $your color
on FMX
set Fill > Kind = Solid after that you can set color on Fill > color

Theme button text using Angular Material Design

I'd like to use $mdThemingProvider to universally configure all buttons on my site with a custom palette. I can manipulate the buttons' background color by configuring A200 and A700 in the palette. I would also like to change the default text color. I've jiggered with contrastDefaultColor, contrastLightColors, and contrastDarkColors but the best I've been able to do is get black or white text.
The following snippit will produce white buttons with dark text:
var lightGrey = $mdThemingProvider.extendPalette('grey', {
'A200': '#fefefe', // Element background color (default)
'A700': '#fefefe', // Element hover background color (default)
'contrastDefaultColor': 'dark',
'contrastLightColors': '600 700 800 900'
});
$mdThemingProvider.definePalette('light-grey', lightGrey);
$mdThemingProvider.theme('default')
// Accent palette controls buttons, links, etc
.accentPalette('light-grey');
Changing contrastDefaultColor to "light" causes the text to turn white.
I could manually achieve the effect I want by overriding the generated stylesheet's rules:
.md-button.md-default-theme.md-fab {
color: #bdc3c7;
}
...but I'm trying to use the tools provided in the library.
I don't know why you are facing this problem but by giving A200 & A700 the color you want to give will solve the problem. like this:
var lightGrey = $mdThemingProvider.extendPalette('grey', {
'A200': '#bdc3c7', // Element background color (default)
'A700': '#bdc3c7', // Element hover background color (default)
'contrastDefaultColor': 'dark',
'contrastLightColors': ['600', '700', '800', '900']
});
Note: Try to give contrast palette in array form.
And if you are facing some different problem please update or you can refer this link

How to simulate the selection/deselection of a text on a Canvas in Delphi?

I want to simulate on a Canvas a selection/deselection of a text (like in a TEdit) in Delphi 7.
I use FillRect to change the background color and TextOut to draw the text.
But I need to know 4 color values for:
unselected text;
selected text;
background of the unselected text;
background of the selected text.
These values are changing when the user changes the Windows theme or edits the appearance of the windows.
For Classic theme in Windows XP the values are: clBlack, clWhite, clWhite, clNavy.
Maybe there are cl* constants for this in Delphi or maybe I have to use Api functions to get them.
Does anybody know how...?
Thank you.
Unselected:
clWindow
clWindowText
Selected:
clHighlight
clHighlightText

Implementing a 'tag panel' control in Delphi?

Please have a look at this screenshot
alt text http://www.maclife.com/files/u18/Yep3-big.jpg
I think these are the main features of such a 'tag panel':
1) Each tag on the panel is a standalone control and can be clicked
2) Auto line wrapping when there is not enough space to show the next tag in the current line.
3) Rounded corner rectangle border for each tag is a nice-to-have feature.
I want to implement the similar function in Delphi, Is there an existing control to do this? If not, what's the best way to implement such a control?
Thank you.
When you are on a recent Delphi version use a TFlowPanel and some appropriate controls for the tags. A simple TButton or a TLinkLabel should do for that.
Each clickable tag doesn't necessarily have to be its own control. It just has to be a region that you can detect being clicked.
Suppose you represent each area as a Windows region. You can figure out how wide each one should be based on its text with the TCanvas.TextExtent function. Then create a region with a function like CreateRectRgn. For rounded corners, try CreateRoundRectRgn instead. You can test for mouse events in each region with the PtInRegion function. You can paint borders around them with FrameRgn. The last obstacle is to draw them on the screen so they'll all fit. You're creating the regions and you know their widths, so assign tags to a row until you run out of space, and then start the next line.
There are two possible solutions to custom alignment in Delphi 7. You can make your own flowpanel by deriving from TCustomPanel and override the AlignControls( )-method, or you can set alignment to alCustom and handle the OnAlignPosition-event.
I guess I would have gone for the TCustomPanel-derivative option. TFlowPanel in form Delphi 2007 uses that option- I have to admit, though, that I have never tried either my self...

Delphi component spTbxToolbar skin change

How to change at runtime by code (not for groupskintype), the skin type for a sptbxtoolbar component?
You can only change the skin of all SpTBXLib components at once.
Use this code
SkinManager.SetSkin('Office 2007 Blue');
You can however set for each SpTBXLib component if it is drawed using the skin, Windows look or the default look, by setting assigning the SkinType property.
MyComponent.SkinType := sknWindows;
Hint: Toolbars itself do not have the SkinType property. They are always drawn using the skin.
I don't know that component, but found this with Google. Hope it helps.

Resources