From bb7a0731ed67a7e9939fb339f61ac6dbfcaca817 Mon Sep 17 00:00:00 2001 From: blikblum Date: Fri, 27 Aug 2010 01:48:32 +0000 Subject: [PATCH] lcl: uncheck radiobutton siblings when handle not allocated, bug #17281 git-svn-id: trunk@27208 - --- lcl/include/radiobutton.inc | 20 ++++++++++++++++++++ lcl/stdctrls.pp | 1 + 2 files changed, 21 insertions(+) diff --git a/lcl/include/radiobutton.inc b/lcl/include/radiobutton.inc index ea9caea339..540790042c 100644 --- a/lcl/include/radiobutton.inc +++ b/lcl/include/radiobutton.inc @@ -96,6 +96,26 @@ begin RegisterRadioButton; end; +procedure TRadioButton.ApplyChanges; +var + Sibling: TControl; + i: Integer; +begin + inherited ApplyChanges; + //the siblings are unchecked by the widgetset. When the handle is not allocated, + //the widgetset is not notified so it cannot update the siblings + if not HandleAllocated and (FState = cbChecked) and + (not (csLoading in ComponentState)) then + begin + for i := 0 to Parent.ControlCount - 1 do + begin + Sibling := Parent.Controls[i]; + if (Sibling is TRadioButton) and (Sibling <> Self) then + TRadioButton(Sibling).Checked := False; + end; + end; +end; + function TRadioButton.DialogChar(var Message: TLMKey): boolean; begin if IsAccel(Message.CharCode, Caption) and CanFocus then diff --git a/lcl/stdctrls.pp b/lcl/stdctrls.pp index ddeb4100d5..0fa2ef7c87 100644 --- a/lcl/stdctrls.pp +++ b/lcl/stdctrls.pp @@ -1315,6 +1315,7 @@ type TRadioButton = class(TCustomCheckBox) protected class procedure WSRegisterClass; override; + procedure ApplyChanges; override; function DialogChar(var Message: TLMKey): boolean; override; procedure RealSetText(const Value: TCaption); override; procedure DoClickOnChange; override;