mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-04 04:18:22 +01:00
lcl: fix sibling radio buttons check state on unchecked radio button click (bug #0013939)
git-svn-id: trunk@20564 -
This commit is contained in:
parent
1a7f012ea8
commit
cffb63915e
@ -47,9 +47,9 @@ end;
|
||||
|
||||
procedure TButtonControl.DoOnChange;
|
||||
begin
|
||||
if Checked=fLastCheckedOnChange then exit;
|
||||
fLastCheckedOnChange:=Checked;
|
||||
if [csLoading,csDestroying,csDesigning]*ComponentState<>[] then exit;
|
||||
if Checked = FLastCheckedOnChange then Exit;
|
||||
FLastCheckedOnChange := Checked;
|
||||
if [csLoading, csDestroying, csDesigning] * ComponentState <> [] then Exit;
|
||||
EditingDone;
|
||||
if Assigned(OnChange) then OnChange(Self);
|
||||
end;
|
||||
|
||||
@ -48,8 +48,8 @@ end;
|
||||
------------------------------------------------------------------------------}
|
||||
function TCustomCheckBox.GetState: TCheckBoxState;
|
||||
begin
|
||||
fState := RetrieveState;
|
||||
Result := fState;
|
||||
FState := RetrieveState;
|
||||
Result := FState;
|
||||
end;
|
||||
|
||||
procedure TCustomCheckBox.DoChange(var Msg);
|
||||
@ -57,9 +57,9 @@ var
|
||||
NewState: TCheckBoxState;
|
||||
begin
|
||||
//debugln('TCustomCheckBox.DoChange START ',dbgsname(Self),' ',dbgs(ord(FState)));
|
||||
NewState:=RetrieveState;
|
||||
if FState=NewState then exit;
|
||||
FState:=NewState;
|
||||
NewState := RetrieveState;
|
||||
if FState = NewState then exit;
|
||||
FState := NewState;
|
||||
//debugln('TCustomCheckBox.DoChange CHANGED ',dbgsname(Self),' ',dbgs(ord(FState)));
|
||||
inherited Click; // emulate delphi OnClick behaviour
|
||||
end;
|
||||
@ -77,7 +77,7 @@ end;
|
||||
|
||||
function TCustomCheckBox.RetrieveState: TCheckBoxState;
|
||||
begin
|
||||
Result:=FState;
|
||||
Result := FState;
|
||||
// get the actual state of the component
|
||||
// don't read from interface during loading
|
||||
if HandleAllocated and ([csLoading,csDestroying]*ComponentState=[]) then
|
||||
@ -128,7 +128,7 @@ end;
|
||||
------------------------------------------------------------------------------}
|
||||
function TCustomCheckBox.GetChecked : Boolean;
|
||||
begin
|
||||
GetChecked := (GetState = cbChecked);
|
||||
Result := (GetState = cbChecked);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
|
||||
@ -72,11 +72,28 @@ begin
|
||||
end;
|
||||
|
||||
procedure TRadioButton.ApplyChanges;
|
||||
begin
|
||||
inherited ApplyChanges;
|
||||
DoApplyChanges;
|
||||
end;
|
||||
|
||||
procedure TRadioButton.SetChecked(Value: Boolean);
|
||||
begin
|
||||
inherited SetChecked(Value);
|
||||
TabStop := Value;
|
||||
end;
|
||||
|
||||
procedure TRadioButton.DoChange(var Msg);
|
||||
begin
|
||||
inherited DoChange(Msg);
|
||||
DoApplyChanges;
|
||||
end;
|
||||
|
||||
procedure TRadioButton.DoApplyChanges;
|
||||
var
|
||||
i: Integer;
|
||||
Sibling: TControl;
|
||||
begin
|
||||
inherited ApplyChanges;
|
||||
if not (csLoading in ComponentState) and (Parent <> nil) and (FState = cbChecked) then
|
||||
begin
|
||||
for i := 0 to Parent.ControlCount - 1 do
|
||||
@ -88,12 +105,6 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TRadioButton.SetChecked(Value: Boolean);
|
||||
begin
|
||||
inherited SetChecked(Value);
|
||||
TabStop := Value;
|
||||
end;
|
||||
|
||||
class procedure TRadioButton.WSRegisterClass;
|
||||
begin
|
||||
inherited WSRegisterClass;
|
||||
@ -111,7 +122,7 @@ begin
|
||||
if IsAccel(Message.CharCode, Caption) and CanFocus then
|
||||
begin
|
||||
SetFocus;
|
||||
Result := true;
|
||||
Result := True;
|
||||
end else
|
||||
Result := inherited;
|
||||
end;
|
||||
|
||||
@ -1027,7 +1027,7 @@ type
|
||||
function IsCheckedStored: boolean;
|
||||
procedure WMDefaultClicked(var Message: TLMessage); message LM_CLICKED;
|
||||
protected
|
||||
fLastCheckedOnChange: boolean;
|
||||
FLastCheckedOnChange: boolean;
|
||||
class procedure WSRegisterClass; override;
|
||||
function GetChecked: Boolean; virtual;
|
||||
procedure SetChecked(Value: Boolean); virtual;
|
||||
@ -1303,6 +1303,8 @@ type
|
||||
procedure RealSetText(const Value: TCaption); override;
|
||||
procedure ApplyChanges; override;
|
||||
procedure SetChecked(Value: Boolean); override;
|
||||
procedure DoChange(var Msg); message LM_CHANGED;
|
||||
procedure DoApplyChanges;
|
||||
public
|
||||
constructor Create(TheOwner: TComponent); override;
|
||||
published
|
||||
|
||||
Loading…
Reference in New Issue
Block a user