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

View File

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