Delphi Programming Tutorial #59 - Popup Menu from Button

preview_player
Показать описание
In this brief tutorial Alister Christie shows how to popup a menu when we click on a button.

Alister Christie is a Delphi MVP (Most Valued Professional), Consultant, Developer, Trainer, Presenter, and Author. He has presented at ADUG (Australasian Delphi Users Group) Symposia and Code Rage Conferences for many years. Alister holds a degree in Mathematics and Computer Science from Victoria University, Wellington. He lives near Wellington, New Zealand.

On this YouTube Channel, Alister has created many hours of video tutorials to help you learn Delphi Programming in efficient and effective ways. Using his lessons, you will programme faster and better, skills applicable for beginners through to experts wanting to expand their programming and coding proficiency.

Video topics by Alister Christie include VCL (Visual Component Library), FireMonkey, FireDAC, Cross-platform, Android, iOS (iPad or iPhone Operating System), Mac OS/X, Windows, IoT (Internet of Things), Algorithms, and more.

Рекомендации по теме
Комментарии
Автор

@eitan71 Unfortunately no, Button1.Left would be the co-ordinate relative to the form, not the screen. If you did PopupMenu1.Popup(0, 0) the menu would appear in the top left corner of the screen, not the form.

codegearguru
Автор

Hi how are things?
Could you help me explaining how to prevent a popup menu from overflowing, that is, it has a limited height and maybe a scroll.
Thank you very much.

pruebasjdoc
Автор

How to close popup menu when mouse click outside it? (I am using similar code for the system tray icon. but I can not close the menu when clicking on the desktop.)

СерхиоБускетс-фя
Автор

Thank you. Do you know how to get the exact image position? (I'm working with FMX)

I did this:

procedure TForm1.Image1Click(Sender: TObject);
var
P : TPointF;
begin
P.X := 0;
P.Y := 0;
P := Image1.LocalToAbsolute(P);
P := ClientToScreen(P);
PopupMenu1.Popup(P.X, P.Y+50);
end;

profwtelles
Автор

btw, isn't
PopupMenu1.Popup(Button1.Left, Button1.Top + Button1.Highet);
the same?

eitan
Автор

How to know if a popup just closed (like an OnClose or OnHide event)?

AlexTuduran
Автор

greate vid
Thanks you
just please, for those who doesn't speak english as their main laguage, please talk a little slower
keep up the good work :)

eitan
Автор

You maybe want to rush the video a lil more so that i can understand you less..xD...people watch tutorials to learn not to try keep up with you

teddyboigaming
welcome to shbcf.ru