diff --git a/lcl/include/customcheckbox.inc b/lcl/include/customcheckbox.inc index d235224e1d..7c938a8b13 100644 --- a/lcl/include/customcheckbox.inc +++ b/lcl/include/customcheckbox.inc @@ -48,6 +48,7 @@ begin if FState <> Value then begin FState := Value; + //debugln('TCustomCheckBox.SetState ',dbgsname(Self),' ',dbgs(ord(FState))); ApplyChanges; end; end; @@ -73,6 +74,7 @@ begin NewState:=RetrieveState; if FState=NewState then exit; FState:=RetrieveState; + //debugln('TCustomCheckBox.DoChange ',dbgsname(Self),' ',dbgs(ord(FState))); DoOnChange; end; @@ -80,8 +82,11 @@ function TCustomCheckBox.RetrieveState: TCheckBoxState; begin Result:=FState; // get the actual state of the component - if HandleAllocated then + // don't read from interface during loading + if HandleAllocated and ([csLoading,csDestroying]*ComponentState=[]) then begin Result := TWSCustomCheckBoxClass(WidgetSetClass).RetrieveState(Self); + //debugln('TCustomCheckBox.RetrieveState ',dbgsname(Self),' ',dbgs(ord(Result))); + end; end; {------------------------------------------------------------------------------ @@ -144,6 +149,7 @@ begin FState := cbChecked else FState := cbUnChecked; + //debugln('TCustomCheckBox.DoChange ',dbgsname(Self),' ',dbgs(ord(FState))); if FState <> OldState then begin if Assigned(Action) @@ -180,10 +186,19 @@ end; procedure TCustomCheckBox.ApplyChanges; begin if HandleAllocated and (not (csLoading in ComponentState)) then begin + //debugln('TCustomCheckBox.ApplyChanges ',dbgsname(Self),' ',dbgs(ord(FState))); TWSCustomCheckBoxClass(WidgetSetClass).SetState(Self, FState); end; end; +procedure TCustomCheckBox.Loaded; +begin + // set first the loaded FState, otherwise the inherited Loaded will load the + // the interface state + TWSCustomCheckBoxClass(WidgetSetClass).SetState(Self, FState); + inherited Loaded; +end; + {------------------------------------------------------------------------------ procedure TCustomCheckBox.RealSetText(const Value: TCaption); ------------------------------------------------------------------------------} @@ -212,6 +227,9 @@ end; { $Log$ + Revision 1.28 2005/01/01 19:36:40 mattias + fixed loading TRadioButton.Checked + Revision 1.27 2004/11/03 14:18:35 mattias implemented preferred size for controls for theme depending AutoSizing diff --git a/lcl/include/radiobutton.inc b/lcl/include/radiobutton.inc index e340c886f1..c812e1e1c1 100644 --- a/lcl/include/radiobutton.inc +++ b/lcl/include/radiobutton.inc @@ -53,7 +53,6 @@ constructor TRadioButton.Create(TheOwner : TComponent); begin inherited Create(TheOwner); fCompStyle := csRadioButton; - AutoSize := True; end; {------------------------------------------------------------------------------ @@ -103,6 +102,9 @@ end; { $Log$ + Revision 1.20 2005/01/01 19:36:40 mattias + fixed loading TRadioButton.Checked + Revision 1.19 2004/11/03 14:18:35 mattias implemented preferred size for controls for theme depending AutoSizing diff --git a/lcl/stdctrls.pp b/lcl/stdctrls.pp index 13a2757182..fa053b0825 100644 --- a/lcl/stdctrls.pp +++ b/lcl/stdctrls.pp @@ -834,7 +834,6 @@ type TCustomCheckBox = class(TButtonControl) private - // FAlignment: TLeftRight; FAllowGrayed: Boolean; FState: TCheckBoxState; FShortCut: TShortcut; @@ -849,10 +848,12 @@ type procedure SetChecked(Value: Boolean); override; procedure RealSetText(const Value: TCaption); override; procedure ApplyChanges; virtual; + procedure Loaded; override; public constructor Create(TheOwner: TComponent); override; public - property AllowGrayed: Boolean read FAllowGrayed write FAllowGrayed; + property AutoSize default true; + property AllowGrayed: Boolean read FAllowGrayed write FAllowGrayed default True; property State: TCheckBoxState read GetState write SetState; property TabStop default true; property UseOnChange; @@ -1212,6 +1213,9 @@ end. { ============================================================================= $Log$ + Revision 1.177 2005/01/01 19:36:40 mattias + fixed loading TRadioButton.Checked + Revision 1.176 2004/12/31 11:59:47 mattias published TEdit.Color - only useful under windows, gtk1 ignores it diff --git a/lcl/widgetset/wsstdctrls.pp b/lcl/widgetset/wsstdctrls.pp index 34625f2a3a..ef0f8d6ba8 100644 --- a/lcl/widgetset/wsstdctrls.pp +++ b/lcl/widgetset/wsstdctrls.pp @@ -172,13 +172,13 @@ type { TWSCustomCheckBox } - TWSCustomCheckBoxClass = class of TWSCustomCheckBox; TWSCustomCheckBox = class(TWSButtonControl) class function RetrieveState(const ACustomCheckBox: TCustomCheckBox): TCheckBoxState; virtual; class procedure SetShortCut(const ACustomCheckBox: TCustomCheckBox; const OldShortCut, NewShortCut: TShortCut); virtual; class procedure SetState(const ACustomCheckBox: TCustomCheckBox; const NewState: TCheckBoxState); virtual; end; + TWSCustomCheckBoxClass = class of TWSCustomCheckBox; { TWSCheckBox }