mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-05-28 03:42:50 +02:00
fixed loading TRadioButton.Checked
git-svn-id: trunk@6452 -
This commit is contained in:
parent
2d0f725a44
commit
965c1e6b30
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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 }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user