Jump to content

popup on grid on frame


altagur

Recommended Posts

I am use popup menu for grid on frame on panel on form

 

How calculate position for popup method call? What class have properties Parent, Left,Top? Why with Unypopup menu opens system browser popup menu?

 

 

For example:

 

grid1 on frame1 on panel1 on panel2 on form1

 

procedure TFrame1.Grid1MouseDown(Sender: TObject;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
var F: TUniForm; X0,Y0: Integer;
begin
    MainMenu.Popup(X+Left+Parent.left+Parent.Parent.Left+Parent.Parent.Parent.Left,  etc );
    end;
end;

 

Recursive procedure?

 

function TAnyHtmlFrame.FindParentForm(var X:Integer; var Y: Integer): TUniForm;
var Ct: TObject;
begin
  //x := 0;  y := 0;
  Result := nil;
  Ct := Self;
  while (C<>nil) do
    begin
    if Ct is TUniCOntrol then
      begin
      Inc(x, TUniCOntrol(Ct).Left);
      Inc(y, TUniCOntrol(Ct).Top);
      C := TUniControl(Ct).Parent;
      end
    else if Ct is TUniFrame then
      begin
      Inc(x, TUniFrame(Ct).Left);
      Inc(y, TUniFrame(Ct).Top);
      C := TUniFrame(Ct).Parent;
      end
    else if Ct is TUniForm then
      begin
      Inc(x, TUniForm(Ct).Left);
      Inc(y, TUniForm(Ct).Top);
      Ct := TUniForm(Ct).Parent;
      end
    end;
end;
 

 

Is it possible do normal property PopupMenu for Unigui Controls and do whis internally? Why i must for all controls write OnMouse Down and call .Popup and calculate position?

 

Why with TUniPopup menu opens system browser popup by right mouse down?

 

TUniXPopupMenu work properly before TUniPopupMenu

 

This popup menu is very very useful for interface. But in current situation too difficult to use it

 

 

Thanks for reply

Nik Gurov (altagur)

Link to comment
Share on other sites

  • 3 years later...

Hi,

 

This is normal behavior,

 

To correctly show UniPopupMenu for example, specify relative object:

procedure TMainForm.UniContainerPanel1MouseDown(Sender: TObject;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
  UniPopupMenu1.Popup(X, Y, Sender);
end;

Best regards,

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...