Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PopUpMenu Problem

Status
Not open for further replies.

mikeo2l

Technical User
Sep 27, 2001
20
IE
Can anyone tell me why my popupmenu is opening at 0,0 i.e. the monitor top left. I have used the example in builder but it dont work. How do I return the position of the current window/form without writing yards of code. I might add my help is crashing so I can use it to get answers.

Mike
 
> Can anyone tell me why my popupmenu is opening at 0,0 i.e. the monitor top left.

How are you displaying the popup menu? If you are doing something like:

Code:
PopupMenu1->Popup(0,0);[code]

0,0 are absolute screen coordinates: monitor top, left (well, actually screen top,left).

Normally you associate a popup menu with a component, like a form or a toolbar etc. by setting the PopupMenu property of the component. Then the popup menu is automatically displayed at the cursor location when you right click that component. You wouldn't then need to worry about determining the cursor location.

I think your other question was answered in your other post.
 
Was using PopupMenu1->PopupMenu(X,Y);
But X and Y were screen co-ordinates i.e. 0,0.

Used below (Ceol being the form)

X = Ceol->Left;
Y = Ceol->Top;
To get the relative position and then...

PopupMenu1->Popup(X+10,Y+10);

Many Thanks.




 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top