LCL, changing AllowGrayed at runtime has no effect (windows), fixed

git-svn-id: trunk@19892 -
This commit is contained in:
jesus 2009-05-10 03:34:08 +00:00
parent c688af0189
commit a849d36c9a
4 changed files with 24 additions and 1 deletions

View File

@ -38,6 +38,15 @@ begin
end; end;
end; end;
procedure TCustomCheckBox.SetAllowGrayed(const AValue: Boolean);
begin
if AValue<>FAllowGrayed then begin
FAllowGrayed := AValue;
if HandleAllocated then
TWSCustomCheckBoxClass(WidgetSetClass).AllowGrayedChanged(Self);
end;
end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------
Method: TCustomCheckBox.GetState Method: TCustomCheckBox.GetState
Params: none Params: none

View File

@ -257,6 +257,7 @@ type
class procedure SetBiDiMode(const AWinControl: TWinControl; UseRightToLeftAlign, class procedure SetBiDiMode(const AWinControl: TWinControl; UseRightToLeftAlign,
UseRightToLeftReading, UseRightToLeftScrollBar : Boolean); override; UseRightToLeftReading, UseRightToLeftScrollBar : Boolean); override;
class procedure SetState(const ACustomCheckBox: TCustomCheckBox; const NewState: TCheckBoxState); override; class procedure SetState(const ACustomCheckBox: TCustomCheckBox; const NewState: TCheckBoxState); override;
class procedure AllowGrayedChanged(const ACustomCheckbox: TCustomCheckbox); override;
end; end;
{ TWin32WSCheckBox } { TWin32WSCheckBox }
@ -1537,6 +1538,12 @@ begin
Windows.SendMessage(ACustomCheckBox.Handle, BM_SETCHECK, Flags, 0); Windows.SendMessage(ACustomCheckBox.Handle, BM_SETCHECK, Flags, 0);
end; end;
class procedure TWin32WSCustomCheckBox.AllowGrayedChanged(
const ACustomCheckbox: TCustomCheckbox);
begin
RecreateWnd(ACustomCheckbox);
end;
{ TWin32WSToggleBox } { TWin32WSToggleBox }
class function TWin32WSToggleBox.CreateHandle(const AWinControl: TWinControl; class function TWin32WSToggleBox.CreateHandle(const AWinControl: TWinControl;

View File

@ -1165,6 +1165,7 @@ type
FAllowGrayed: Boolean; FAllowGrayed: Boolean;
FState: TCheckBoxState; FState: TCheckBoxState;
FShortCut: TShortcut; FShortCut: TShortcut;
procedure SetAllowGrayed(const AValue: Boolean);
procedure SetState(Value: TCheckBoxState); procedure SetState(Value: TCheckBoxState);
function GetState: TCheckBoxState; function GetState: TCheckBoxState;
procedure DoChange(var Msg); message LM_CHANGED; procedure DoChange(var Msg); message LM_CHANGED;
@ -1187,7 +1188,7 @@ type
constructor Create(TheOwner: TComponent); override; constructor Create(TheOwner: TComponent); override;
public public
property AutoSize default true; property AutoSize default true;
property AllowGrayed: Boolean read FAllowGrayed write FAllowGrayed default false; property AllowGrayed: Boolean read FAllowGrayed write SetAllowGrayed default false;
property State: TCheckBoxState read GetState write SetState default cbUnchecked; property State: TCheckBoxState read GetState write SetState default cbUnchecked;
property TabStop default true; property TabStop default true;
property OnChange; property OnChange;

View File

@ -222,6 +222,7 @@ type
class procedure SetShortCut(const ACustomCheckBox: TCustomCheckBox; class procedure SetShortCut(const ACustomCheckBox: TCustomCheckBox;
const OldShortCut, NewShortCut: TShortCut); virtual; const OldShortCut, NewShortCut: TShortCut); virtual;
class procedure SetState(const ACustomCheckBox: TCustomCheckBox; const NewState: TCheckBoxState); virtual; class procedure SetState(const ACustomCheckBox: TCustomCheckBox; const NewState: TCheckBoxState); virtual;
class procedure AllowGrayedChanged(const ACustomCheckbox: TCustomCheckbox); virtual;
end; end;
TWSCustomCheckBoxClass = class of TWSCustomCheckBox; TWSCustomCheckBoxClass = class of TWSCustomCheckBox;
@ -578,6 +579,11 @@ class procedure TWSCustomCheckBox.SetState(const ACustomCheckBox: TCustomCheckBo
begin begin
end; end;
class procedure TWSCustomCheckBox.AllowGrayedChanged(
const ACustomCheckbox: TCustomCheckbox);
begin
end;
{ WidgetSetRegistration } { WidgetSetRegistration }
procedure RegisterCustomScrollBar; procedure RegisterCustomScrollBar;