mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-22 11:19:26 +02:00
added robust mechanism to TRadioGroup.SetItemIndex for lazy interfaces
git-svn-id: trunk@7344 -
This commit is contained in:
parent
97055a0514
commit
a76a810302
@ -625,17 +625,18 @@ type
|
||||
private
|
||||
FButtonList: TList; // list of TRadioButton
|
||||
FColumnLayout: TColumnLayout;
|
||||
FHiddenButton: TRadioButton;
|
||||
FCreatingWnd: boolean;
|
||||
FItems: TStrings;
|
||||
FItemIndex: integer;
|
||||
FColumns: integer;
|
||||
FReading: boolean;
|
||||
FOnClick: TNotifyEvent;
|
||||
FCreatingWnd: boolean;
|
||||
FHiddenButton: TRadioButton;
|
||||
FItemIndex: integer;
|
||||
FItems: TStrings;
|
||||
FLastClickedItemIndex: integer;
|
||||
FOnClick: TNotifyEvent;
|
||||
FReading: boolean;
|
||||
fIgnoreClicks: boolean;
|
||||
procedure ItemsChanged(Sender: TObject);
|
||||
procedure Clicked(Sender: TObject); virtual;
|
||||
procedure Changed(Sender: TObject); virtual;
|
||||
procedure Clicked(Sender: TObject);
|
||||
procedure Changed(Sender: TObject);
|
||||
procedure DoPositionButtons;
|
||||
procedure SetColumnLayout(const AValue: TColumnLayout);
|
||||
protected
|
||||
@ -1013,6 +1014,9 @@ end.
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.139 2005/07/13 17:48:57 mattias
|
||||
added robust mechanism to TRadioGroup.SetItemIndex for lazy interfaces
|
||||
|
||||
Revision 1.138 2005/07/09 16:20:50 mattias
|
||||
TSplitter can now also work with Align=alNone and AnchorSide
|
||||
|
||||
|
@ -232,6 +232,9 @@ end;
|
||||
Select one of the radiobuttons
|
||||
------------------------------------------------------------------------------}
|
||||
procedure TCustomRadioGroup.SetItemIndex(Value : integer);
|
||||
var
|
||||
OldItemIndex: LongInt;
|
||||
OldIgnoreClicks: Boolean;
|
||||
begin
|
||||
if Value = FItemIndex then exit;
|
||||
if FReading then
|
||||
@ -245,14 +248,26 @@ begin
|
||||
// the radiobuttons are grouped by the widget interface
|
||||
// and some does not allow to uncheck all buttons in a group
|
||||
// Therefore there is a hidden button
|
||||
OldItemIndex:=FItemIndex;
|
||||
FItemIndex:=Value;
|
||||
if (FItemIndex <> -1) then
|
||||
TRadioButton(FButtonList[FitemIndex]).Checked := true
|
||||
else
|
||||
FHiddenButton.Checked:=true;
|
||||
OldIgnoreClicks:=fIgnoreClicks;
|
||||
fIgnoreClicks:=true;
|
||||
try
|
||||
if (FItemIndex <> -1) then
|
||||
TRadioButton(FButtonList[FItemIndex]).Checked := true
|
||||
else
|
||||
FHiddenButton.Checked:=true;
|
||||
// uncheck old radiobutton
|
||||
if OldItemIndex <> -1 then
|
||||
TRadioButton(FButtonList[FItemIndex]).Checked := false
|
||||
else
|
||||
FHiddenButton.Checked:=false;
|
||||
finally
|
||||
fIgnoreClicks:=OldIgnoreClicks;
|
||||
end;
|
||||
// this has automatically unset the old button. But they do not recognize
|
||||
// it. Update the states.
|
||||
UpdateRadioButtonStates;
|
||||
CheckItemIndexChanged;
|
||||
|
||||
OwnerFormDesignerModified(Self);
|
||||
end
|
||||
@ -336,6 +351,7 @@ end;
|
||||
------------------------------------------------------------------------------}
|
||||
Procedure TCustomRadioGroup.Clicked(Sender : TObject);
|
||||
Begin
|
||||
if fIgnoreClicks then exit;
|
||||
CheckItemIndexChanged;
|
||||
end;
|
||||
|
||||
@ -425,6 +441,9 @@ end;
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.9 2005/07/13 17:48:57 mattias
|
||||
added robust mechanism to TRadioGroup.SetItemIndex for lazy interfaces
|
||||
|
||||
Revision 1.8 2005/03/25 17:47:55 mattias
|
||||
implemented TMemo text for gtk2, TRadioGroup.OnClick is now called whenever ItemIndex changed, so it works now also under gtk2 Delphi compatible from Andrew Haines
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user