abhimanyu Posted January 23, 2017 Share Posted January 23, 2017 Hi, I have panel in main form when I click in the region of panel at position I need to open the popupmenu but it open at different position not that current position. procedure TMainForm.UniPanel1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); var pt: TPoint; begin pt := Mouse.CursorPos; pt := ScreenToClient(pt); if Button = mbLeft then begin UniPopupMenu1.Popup(pt.x, pt.y); end; end; Link to comment Share on other sites More sharing options...
mhmda Posted January 23, 2017 Share Posted January 23, 2017 it's relative to the panel, If you want the absolute location you have to add the panel's offset (x,y) Link to comment Share on other sites More sharing options...
Sherzod Posted January 23, 2017 Share Posted January 23, 2017 Hi, You can use just like this: procedure TMainForm.UniPanel1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); begin if Button = mbLeft then begin UniPopupMenu1.Popup(X, Y, Sender); end; end; Best regards. Link to comment Share on other sites More sharing options...
M477H13U Posted June 8, 2018 Share Posted June 8, 2018 it's relative to the panel, If you want the absolute location you have to add the panel's offset (x,y) Hello there ! How may I achieve something like that if my panel Align prop is set to alRight (and so panel's offset is (0,0)) ? Link to comment Share on other sites More sharing options...
Sherzod Posted June 8, 2018 Share Posted June 8, 2018 Hello, How may I achieve something like that if my panel Align prop is set to alRight (and so panel's offset is (0,0)) ? Have you tried to check the above code ?! It should work Link to comment Share on other sites More sharing options...
M477H13U Posted June 8, 2018 Share Posted June 8, 2018 Oups .. I'm quite sorry, I did not notice the third parameter of Popup fonction ^^" Thank you for the quick answer Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now