Jump to content

TUniPopupMenu


MarBar77

Recommended Posts

Hi,

 

How to get component, from which menu item was clicked.

 

I try

 

procedure TfrElectricityOnline.mnIndicatorDeleteClick(Sender: TObject);
var
  Caller: TObject;
begin
  Caller := ((Sender as TUniMenuItem).GetParentMenu as TUniPopupMenu).PopupComponent;
end;
 
but it results with Caller = nil?
 
PopupMenu is assigned in runtime to components
 
MyComponent.PopupMenu := MyPopupMenu;
 
Marcin
Link to comment
Share on other sites

  • 5 years later...
On 3/10/2018 at 8:10 AM, MarBar77 said:

Hi,

 

How to get component, from which menu item was clicked.

 

I try

 

procedure TfrElectricityOnline.mnIndicatorDeleteClick(Sender: TObject);
var
  Caller: TObject;
begin
  Caller := ((Sender as TUniMenuItem).GetParentMenu as TUniPopupMenu).PopupComponent;
end;
 
but it results with Caller = nil?
 
PopupMenu is assigned in runtime to components
 
MyComponent.PopupMenu := MyPopupMenu;
 
Marcin

 

Hello, I need a solution to this issue.

 
Link to comment
Share on other sites

Solution

type
 TUniPopupMenu = Class(uniMainMenu.TUniPopupMenu)
 Public
 ObjetoPai : TObject;
 End;

procedure TForm_MenuPrincipal.UniDBGridCellContextClick(Column: TUniDBGridColumn; X, Y: Integer);
begin
 PopupMenu_Grid.fObjetoPai := TUniDBGrid(Column.Grid);

 PopupMenu_Grid.Popup(X, Y, TUniDBGrid(Column.Grid));
end;

 ObjetoGrid := ((Sender as TUniMenuItem).GetParentMenu as TPopupMenu).fObjetoPai

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...