From a78f65fa1c1dc35922205e7cf88ac431aee59bb6 Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Wed, 7 Mar 2007 10:14:45 +0000 Subject: * Added more debug events. * Implemented a very basic TPopupMenu * Modified the WidgetTest demo to show the basic popup menu (still needs work). --- examples/gui/widgettest/widgettest.lpi | 2 +- examples/gui/widgettest/widgettest.pas | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) (limited to 'examples/gui') diff --git a/examples/gui/widgettest/widgettest.lpi b/examples/gui/widgettest/widgettest.lpi index efbb9314..19413c4a 100644 --- a/examples/gui/widgettest/widgettest.lpi +++ b/examples/gui/widgettest/widgettest.lpi @@ -52,7 +52,7 @@ - diff --git a/examples/gui/widgettest/widgettest.pas b/examples/gui/widgettest/widgettest.pas index 0e144ae1..4c4f4a32 100644 --- a/examples/gui/widgettest/widgettest.pas +++ b/examples/gui/widgettest/widgettest.pas @@ -191,6 +191,7 @@ type TMenuForm = class(TTestForm) private procedure CloseMenuClicked(Sender: TObject); + procedure AboutMenuClicked(Sender: TObject); public constructor Create(AOwner: TComponent); override; published @@ -264,7 +265,16 @@ begin Close; end; +procedure TMenuForm.AboutMenuClicked(Sender: TObject); +begin + writeln('...About menu clicked from <' + Sender.ClassName + '>'); + if Sender is TMenuItem then + writeln('From: ' + TMenuItem(Sender).Text); +end; + constructor TMenuForm.Create(AOwner: TComponent); +var + lMenuItem: TMenuItem; begin inherited Create(AOwner); Name := 'MenuForm'; @@ -281,7 +291,10 @@ begin MainMenu.AddMenu('Edit'); MainMenu.AddMenu('Options'); MainMenu.AddMenu('Windows'); - MainMenu.AddMenu('Help'); + lMenuItem := MainMenu.AddMenu('Help'); + lMenuItem.SubMenu.AddMenu('Online Help'); + lMenuItem.SubMenu.AddMenu('Tutorials'); + lMenuItem.SubMenu.AddMenu('About', '', @AboutMenuClicked); Title := TLabel.Create(self); Title.CanExpandWidth := True; -- cgit v1.2.3-70-g09d2