####
use strict;
use Win32::GUI();
my $Menu_id=1;
my $Menu = new Win32::GUI::Menu();
my $MenuButton1 = $Menu->AddMenuButton(
-text => "Menu",
-id => $Menu_id++,
);
my $MenuButton1_Quit = $MenuButton1->AddMenuItem(
-text => "Quit",
-id => $Menu_id++,
-onClick => sub{print"program closed\n"; return -1;},
);
my $MenuButton1_About = $MenuButton1->AddMenuItem(
-text => "About",
-id => $Menu_id++,
-onClick => $MessageBox_About->DoModal(),
);
####
my $Main = new Win32::GUI::Window(
-name => "MainWindow",
-title => "Main Window",
-pos => [ 100, 100 ],
-size => [ 300, 200 ],
-menu => $Menu,
);
$Main->AddLabel(
-name => "Label1",
-text => "Welcome",
-pos => [12,10],
);
####
my $MessageBox_About = new Win32::GUI::Window(
-name => "AboutWindow",
-title => "About this program",
-pos =>[ 150, 150 ],
-size => [150,150],
-parent => $Main,
);
$MessageBox_About->AddLabel(
-name => "MsgBox_Label",
-text => "Blabla",
-pos => [20,20],
);
$MessageBox_About->AddButton(
-name => "MsgBox_Button",
-text => "Ok",
-pos => [50,40],
);
sub MsgBox_Button_Click {return -1;}
#closes the messagebox
####
sub MenuButton1_About_Click{$MessageBox_About->DoModal(); return 0;}