[Lazarus] about checkbox in Object inspector
Juha Manninen
juha.manninen62 at gmail.com
Sat Feb 28 17:10:46 CET 2015
On Sat, Feb 28, 2015 at 12:33 PM, FreeMan <freeman35 at delphiturkiye.com>
wrote:
> fpc & lazarus svn yosemite qt x64
> Is it possible change tick color ?, 'cos hard viewing if its checked and
> not row focused.
>
It is drawn using theme services. It is supposed to look identical with the
other ticks in your system. Does it not?
I copy below the function used for drawing the boolean editor checkboxes.
BTW, now it also works for Set element types.
Sandro Cumerlato and Vojtech Cihak planned to use a new customdrawn
checkbox there.
TCheckboxThemed is already added to LazControls but not yet used for
anything.
It will solve some alignment problems but likely not your tick's visual
appearance because it also will use theme services.
Anyway, if there is a bug then it is in theme services, not in property
editor code.
Regards,
Juha
---
function TPropertyEditor.DrawCheckbox(ACanvas: TCanvas; const ARect: TRect;
IsTrue: Boolean): TRect;
// Draws a Checkbox using theme services for editing booleans.
// Returns the output rectangle adjusted for new text location.
var
Details: TThemedElementDetails;
Check: TThemedButton;
Sz: TSize;
TopMargin: Integer;
VisVal: String;
begin
VisVal := GetVisualValue;
// Draw the box using theme services.
if (VisVal = '') or (VisVal = oisMixed) then
Check := tbCheckBoxMixedNormal
else if IsTrue then
Check := tbCheckBoxCheckedNormal
else
Check := tbCheckBoxUncheckedNormal;
Details := ThemeServices.GetElementDetails(Check);
Sz := ThemeServices.GetDetailSize(Details);
TopMargin := (ARect.Bottom - ARect.Top - Sz.cy) div 2;
Result := ARect;
Inc(Result.Top, TopMargin);
// Left varies by widgetset and theme etc. Real Checkbox itself has a
left margin.
Inc(Result.Left, 2); // ToDo: How to find out the real
margin?
Result.Right := Result.Left + Sz.cx;
Result.Bottom := Result.Top + Sz.cy;
ThemeServices.DrawElement(ACanvas.Handle, Details, Result, nil);
// Text will be written after the box.
Result := ARect;
Inc(Result.Left, Sz.cx + 4);
end;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20150228/68d1d92f/attachment-0003.html>
More information about the Lazarus
mailing list