abhimanyu Posted January 23, 2017 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; Quote
mhmda Posted January 23, 2017 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) Quote
Sherzod Posted January 23, 2017 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. Quote
M477H13U Posted June 8, 2018 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)) ? Quote
Sherzod Posted June 8, 2018 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 Quote
M477H13U Posted June 8, 2018 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 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.