Get coordinates of a component

I am dropping a popup menu on left click of a button.  I need to drop it from the lower left corner of the button.  I've found a SIMILAR question here:
http://www.experts-exchange.com/Programming/Programming_Languages/Delphi/Q_10087977.html?query=popup+menu+left+click&topics=85

I was not able to glean the answer from the answer of that question.  Help!
LVL 1
hibbidijiAsked:
Who is Participating?
 
ZhaawZSoftware DeveloperCommented:
procedure TForm1.Button1Click(Sender: TObject);
var
  p : TPoint;
begin
p := Button1.ClientOrigin;
with p, button1 do PopupMenu1.Popup(x, y + height);
end;
0
 
hibbidijiAuthor Commented:
love it, thanks! next time try to answer a little faster, I had to wait almost 40 minutes at almost 4 in the morning!  I expect you experts to be giving perfect answers within 5 minutes!

Joking - thanks for the lightning fast response!
0
 
ZhaawZSoftware DeveloperCommented:
even shorter:

procedure TForm1.Button1Click(Sender: TObject);
begin
with Button1, ClientOrigin do PopupMenu1.Popup(x, y + height);
end;
0
 
ZhaawZSoftware DeveloperCommented:
Will you accept an answer? Or there's something else you want to ask? :)
0
 
hibbidijiAuthor Commented:
Another time where I was so excited about the answer that I thought i DID accept it!

Thanks again
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.