OI: Use normal CheckBox as Boolean editor until problems with CheckBoxThemed are solved. Issues and .

git-svn-id: trunk@51304 -
This commit is contained in:
juha 2016-01-16 12:14:46 +00:00
parent 363ef73d76
commit 30a53a3bb8
2 changed files with 11 additions and 14 deletions

View File

@ -32,7 +32,7 @@ uses
// FCL
SysUtils, Types, Classes, TypInfo, FPCanvas,
// LCL
{$IFnDEF UseOINormalCheckBox} CheckBoxThemed, {$ENDIF}
{$IFDEF UseOICheckBoxThemed} CheckBoxThemed, {$ENDIF}
InterfaceBase, Forms, Buttons, Graphics, GraphType, StdCtrls, LCLType,
LCLIntf, Controls, ComCtrls, ExtCtrls, LMessages, LazConfigStorage,
LazLoggerBase, Menus, Dialogs, Themes, LCLProc, TreeFilterEdit,
@ -305,7 +305,7 @@ type
ValueEdit: TEdit;
ValueComboBox: TComboBox;
{$IFnDEF UseOINormalCheckBox}
{$IFDEF UseOICheckBoxThemed}
ValueCheckBox: TCheckBoxThemed;
{$ELSE}
ValueCheckBox: TCheckBox;
@ -968,13 +968,13 @@ begin
OnMouseWheel:=@OnGridMouseWheel;
end;
ValueCheckBox:={$IFnDEF UseOINormalCheckBox} TCheckBoxThemed.Create(Self); {$ELSE} TCheckBox.Create(Self); {$ENDIF}
ValueCheckBox:={$IFDEF UseOICheckBoxThemed} TCheckBoxThemed.Create(Self); {$ELSE} TCheckBox.Create(Self); {$ENDIF}
with ValueCheckBox do
begin
Name:='ValueCheckBox';
Visible:=false;
Enabled:=false;
{$IFnDEF UseOINormalCheckBox}
{$IFDEF UseOICheckBoxThemed}
AutoSize := false;
{$ELSE}
AutoSize := true; // SetBounds does not work for CheckBox, AutoSize does.
@ -2099,7 +2099,7 @@ begin
SetActiveControl(FCurrentEdit);
if (FCurrentEdit is TCustomEdit) then
TCustomEdit(FCurrentEdit).SelectAll
{$IFnDEF UseOINormalCheckBox}
{$IFDEF UseOICheckBoxThemed}
else if (FCurrentEdit is TCheckBoxThemed) and WasValueClick then
TCheckBoxThemed(FCurrentEdit).Checked:=not TCheckBoxThemed(FCurrentEdit).Checked;
{$ELSE}
@ -2639,7 +2639,6 @@ var
and (r1.Right=r2.Right) and (r1.Bottom=r2.Bottom);
end;
// AlignEditComponents
begin
if ItemIndex>=0 then
begin
@ -2677,7 +2676,7 @@ begin
{$ENDIF}
Dec(EditCompRect.Top);
end
else if FCurrentEdit is {$IFnDEF UseOINormalCheckBox} TCheckBoxThemed {$ELSE} TCheckBox {$ENDIF} then
else if FCurrentEdit is {$IFDEF UseOICheckBoxThemed} TCheckBoxThemed {$ELSE} TCheckBox {$ENDIF} then
begin // Align CheckBox to the middle vertically
TopMargin := (EditCompRect.Bottom - EditCompRect.Top - ValueCheckBox.Height) div 2;
Inc(EditCompRect.Top, TopMargin);
@ -2702,8 +2701,6 @@ var
NameBgColor: TColor;
Details: TThemedElementDetails;
Size: TSize;
// PaintRow
begin
CurRow := Rows[ARow];
FullRect := RowRect(ARow);

View File

@ -23,7 +23,7 @@ interface
uses
Classes, TypInfo, SysUtils, types, RtlConsts, Forms, Controls, LCLProc,
{$IFnDEF UseOINormalCheckBox} CheckBoxThemed, {$ENDIF}
{$IFDEF UseOICheckBoxThemed} CheckBoxThemed, {$ENDIF}
GraphType, FPCAdds, // for StrToQWord in older fpc versions
StringHashList, ButtonPanel, Graphics, StdCtrls, Buttons, Menus, LCLType,
ExtCtrls, ComCtrls, LCLIntf, Dialogs, EditBtn, PropertyStorage, Grids, ValEdit,
@ -3485,16 +3485,14 @@ procedure TBoolPropertyEditor.PropDrawValue(ACanvas: TCanvas; const ARect: TRect
AState: TPropEditDrawState);
var
TxtRect: TRect;
{$IFnDEF UseOINormalCheckBox}
{$IFDEF UseOICheckBoxThemed}
str: string;
stat: TCheckBoxState;
{$ENDIF}
begin
if FPropertyHook.GetCheckboxForBoolean then
begin // Checkbox for Booleans.
{$IFDEF UseOINormalCheckBox}
TxtRect := DrawCheckbox(ACanvas, ARect, GetOrdValue<>0);
{$ELSE}
{$IFDEF UseOICheckBoxThemed}
TxtRect.Top := -100; // Don't call inherited PropDrawValue
if GetOrdValue<>0 then
begin
@ -3505,6 +3503,8 @@ begin
str := '(False)';
end;
TCheckBoxThemed.PaintSelf(ACanvas, str, ARect, stat, False, False, False, False, taRightJustify);
{$ELSE}
TxtRect := DrawCheckbox(ACanvas, ARect, GetOrdValue<>0);
{$ENDIF}
end
else