Adds TRadioGroup.OnSelectionChanged see bug #21155

git-svn-id: trunk@34957 -
This commit is contained in:
sekelsenmat 2012-01-26 15:35:43 +00:00
parent 98a0eef795
commit 6a8ddee62f
2 changed files with 10 additions and 2 deletions

View File

@ -607,6 +607,7 @@ type
FItems: TStrings;
FLastClickedItemIndex: integer;
FOnClick: TNotifyEvent;
FOnSelectionChanged: TNotifyEvent;
FReading: boolean;
FUpdatingItems: Boolean;
procedure Changed(Sender: TObject);
@ -647,6 +648,7 @@ type
property Columns: integer read FColumns write SetColumns default 1;
property ColumnLayout: TColumnLayout read FColumnLayout write SetColumnLayout default clHorizontalThenVertical;
property OnClick: TNotifyEvent read FOnClick write FOnClick;
property OnSelectionChanged: TNotifyEvent read FOnSelectionChanged write FOnSelectionChanged;
end;
@ -691,6 +693,7 @@ type
property OnMouseMove;
property OnMouseUp;
property OnResize;
property OnSelectionChanged;
property OnStartDrag;
property OnUTF8KeyPress;
property ParentBidiMode;

View File

@ -403,8 +403,11 @@ begin
FItemIndex := Value;
// trigger event to be delphi compat, even if handle isn't allocated.
// issue #15989
if (Value <> OldItemIndex) and not FCreatingWnd and
Assigned(FOnClick) then FOnClick(Self);
if (Value <> OldItemIndex) and not FCreatingWnd then
begin
if Assigned(FOnClick) then FOnClick(Self);
if Assigned(FOnSelectionChanged) then FOnSelectionChanged(Self);
end;
end;
end;
//DebugLn('TCustomRadioGroup.SetItemIndex ',dbgsName(Self),' END Old=',dbgs(FItemIndex),' New=',dbgs(Value));
@ -436,6 +439,8 @@ begin
// for Delphi compatility: OnClick should be invoked, whenever ItemIndex
// has changed
if Assigned (FOnClick) then FOnClick(Self);
// And a better named LCL equivalent
if Assigned (FOnSelectionChanged) then FOnSelectionChanged(Self);
end;
{------------------------------------------------------------------------------