Example:
Popup menu is assigned to many TStringGrid Components. On click of a menu
item of a component I want to type cast the TStringGrid like
TStringGrid(Owner).CopyToClipBoard.
Delphi 6
joseph
Jim P
joseph
"Jim P" <Ji...@mad.scientist.com> wrote in message
news:4898...@newsgroups.borland.com...
The TPopupMenu component has a PopupComponent property for exactly this
purpose.
--
Peter Below (TeamB)
Don't be a vampire (http://slash7.com/pages/vampires),
use the newsgroup archives :
http://www.tamaracka.com/search.htm
http://groups.google.com
joseph
"Peter Below (TeamB)" <no...@nomail.please> wrote in message
news:xn0ftkey...@newsgroups.borland.com...
> Is there a way to get the component which is using/invoking the popup
> menu?
TPopupMenu has a PopupComponent property for that exact purpose.
> Popup menu is assigned to many TStringGrid Components. On click
> of a menu item of a component I want to type cast the TStringGrid
> like TStringGrid(Owner).CopyToClipBoard.
procedure TForm1.CopyMenuItemClick(Sender: TObject);
begin
TStringGrid(TPopupMenu(TMenuItem(Sender).GetParentMenu).PopupComponent).CopyToClipboard;
end;
Or, if you already know which TPopupMenu ahead of time:
procedure TForm1.CopyMenuItemClick(Sender: TObject);
begin
TStringGrid(PopupMenu1.PopupComponent).CopyToClipboard;
end;
Gambit