Board index » cppbuilder » PopUp Menu is show distant of the control...
Eduardo Jauch
CBuilder Developer |
Eduardo Jauch
CBuilder Developer |
PopUp Menu is show distant of the control...2004-06-08 11:59:28 AM cppbuilder28 Hello again... I have a Popup menu that must be showed only under some circunstances. Because of this i set the propert AutoPopUp to false. Bu now, when i show it with the X an Y of the MouseDown Event of my TreeView, The PopUp appears far from the control, outside my form's application... How can i put this popup under the mouse pointer? Thank's for the help Eduardo Jauch. |
JD
CBuilder Developer |
2004-06-08 01:27:07 PM
Re:PopUp Menu is show distant of the control...
Eduardo Jauch < XXXX@XXXXX.COM >wrote:
Quote[...] How can i put this popup under the mouse pointer? X,Y from a control's MouseDown event, those coordinates are client relative. ClientToScreen will convert the control-relative coordinates to screen-relative coordinates: TPoint P = ClientToScreen( TPoint(X,Y) ); Now, instead of passing X,Y to the popup, pass P.x,P.y. ~ JD |
Remy Lebeau (TeamB)
CBuilder Developer |
2004-06-08 01:41:36 PM
Re:PopUp Menu is show distant of the control...
"Eduardo Jauch" < XXXX@XXXXX.COM >wrote in message
QuoteBu now, when i show it with the X an Y of the MouseDown the other hand, expects screen coordinates that are relative to the top-left corner of the entire screen instead. QuoteHow can i put this popup under the mouse pointer? from TControl that you can use for that. For example void __fastcall TForm1::SomeControlMouseDown(TObject* Sender, TMouseButton Button, TShiftState Shift, int X, int Y) { TPoint p = SomeControl->ClientToScreen(Point(X, Y)); PopupMenu1->Popup(p.x, p.y); } Gambit {smallsort} |
Eduardo Jauch
CBuilder Developer |
2004-06-08 10:37:33 PM
Re:PopUp Menu is show distant of the control...
Thank's to both of you Gambit and JD. Now Work fine.
Eduardo Jauch. |