mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-06 14:18:14 +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
|
if FState <> Value then
|
||||||
begin
|
begin
|
||||||
FState := Value;
|
FState := Value;
|
||||||
|
//debugln('TCustomCheckBox.SetState ',dbgsname(Self),' ',dbgs(ord(FState)));
|
||||||
ApplyChanges;
|
ApplyChanges;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -73,6 +74,7 @@ begin
|
|||||||
NewState:=RetrieveState;
|
NewState:=RetrieveState;
|
||||||
if FState=NewState then exit;
|
if FState=NewState then exit;
|
||||||
FState:=RetrieveState;
|
FState:=RetrieveState;
|
||||||
|
//debugln('TCustomCheckBox.DoChange ',dbgsname(Self),' ',dbgs(ord(FState)));
|
||||||
DoOnChange;
|
DoOnChange;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -80,8 +82,11 @@ function TCustomCheckBox.RetrieveState: TCheckBoxState;
|
|||||||
begin
|
begin
|
||||||
Result:=FState;
|
Result:=FState;
|
||||||
// get the actual state of the component
|
// 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);
|
Result := TWSCustomCheckBoxClass(WidgetSetClass).RetrieveState(Self);
|
||||||
|
//debugln('TCustomCheckBox.RetrieveState ',dbgsname(Self),' ',dbgs(ord(Result)));
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
@ -144,6 +149,7 @@ begin
|
|||||||
FState := cbChecked
|
FState := cbChecked
|
||||||
else
|
else
|
||||||
FState := cbUnChecked;
|
FState := cbUnChecked;
|
||||||
|
//debugln('TCustomCheckBox.DoChange ',dbgsname(Self),' ',dbgs(ord(FState)));
|
||||||
if FState <> OldState then
|
if FState <> OldState then
|
||||||
begin
|
begin
|
||||||
if Assigned(Action)
|
if Assigned(Action)
|
||||||
@ -180,10 +186,19 @@ end;
|
|||||||
procedure TCustomCheckBox.ApplyChanges;
|
procedure TCustomCheckBox.ApplyChanges;
|
||||||
begin
|
begin
|
||||||
if HandleAllocated and (not (csLoading in ComponentState)) then begin
|
if HandleAllocated and (not (csLoading in ComponentState)) then begin
|
||||||
|
//debugln('TCustomCheckBox.ApplyChanges ',dbgsname(Self),' ',dbgs(ord(FState)));
|
||||||
TWSCustomCheckBoxClass(WidgetSetClass).SetState(Self, FState);
|
TWSCustomCheckBoxClass(WidgetSetClass).SetState(Self, FState);
|
||||||
end;
|
end;
|
||||||
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);
|
procedure TCustomCheckBox.RealSetText(const Value: TCaption);
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
@ -212,6 +227,9 @@ end;
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$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
|
Revision 1.27 2004/11/03 14:18:35 mattias
|
||||||
implemented preferred size for controls for theme depending AutoSizing
|
implemented preferred size for controls for theme depending AutoSizing
|
||||||
|
|
||||||
|
@ -53,7 +53,6 @@ constructor TRadioButton.Create(TheOwner : TComponent);
|
|||||||
begin
|
begin
|
||||||
inherited Create(TheOwner);
|
inherited Create(TheOwner);
|
||||||
fCompStyle := csRadioButton;
|
fCompStyle := csRadioButton;
|
||||||
AutoSize := True;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
@ -103,6 +102,9 @@ end;
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$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
|
Revision 1.19 2004/11/03 14:18:35 mattias
|
||||||
implemented preferred size for controls for theme depending AutoSizing
|
implemented preferred size for controls for theme depending AutoSizing
|
||||||
|
|
||||||
|
@ -834,7 +834,6 @@ type
|
|||||||
|
|
||||||
TCustomCheckBox = class(TButtonControl)
|
TCustomCheckBox = class(TButtonControl)
|
||||||
private
|
private
|
||||||
// FAlignment: TLeftRight;
|
|
||||||
FAllowGrayed: Boolean;
|
FAllowGrayed: Boolean;
|
||||||
FState: TCheckBoxState;
|
FState: TCheckBoxState;
|
||||||
FShortCut: TShortcut;
|
FShortCut: TShortcut;
|
||||||
@ -849,10 +848,12 @@ type
|
|||||||
procedure SetChecked(Value: Boolean); override;
|
procedure SetChecked(Value: Boolean); override;
|
||||||
procedure RealSetText(const Value: TCaption); override;
|
procedure RealSetText(const Value: TCaption); override;
|
||||||
procedure ApplyChanges; virtual;
|
procedure ApplyChanges; virtual;
|
||||||
|
procedure Loaded; override;
|
||||||
public
|
public
|
||||||
constructor Create(TheOwner: TComponent); override;
|
constructor Create(TheOwner: TComponent); override;
|
||||||
public
|
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 State: TCheckBoxState read GetState write SetState;
|
||||||
property TabStop default true;
|
property TabStop default true;
|
||||||
property UseOnChange;
|
property UseOnChange;
|
||||||
@ -1212,6 +1213,9 @@ end.
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$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
|
Revision 1.176 2004/12/31 11:59:47 mattias
|
||||||
published TEdit.Color - only useful under windows, gtk1 ignores it
|
published TEdit.Color - only useful under windows, gtk1 ignores it
|
||||||
|
|
||||||
|
@ -172,13 +172,13 @@ type
|
|||||||
|
|
||||||
{ TWSCustomCheckBox }
|
{ TWSCustomCheckBox }
|
||||||
|
|
||||||
TWSCustomCheckBoxClass = class of TWSCustomCheckBox;
|
|
||||||
TWSCustomCheckBox = class(TWSButtonControl)
|
TWSCustomCheckBox = class(TWSButtonControl)
|
||||||
class function RetrieveState(const ACustomCheckBox: TCustomCheckBox): TCheckBoxState; virtual;
|
class function RetrieveState(const ACustomCheckBox: TCustomCheckBox): TCheckBoxState; virtual;
|
||||||
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;
|
||||||
end;
|
end;
|
||||||
|
TWSCustomCheckBoxClass = class of TWSCustomCheckBox;
|
||||||
|
|
||||||
{ TWSCheckBox }
|
{ TWSCheckBox }
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user