I've done something like this with a NotifyIcon (see below). I'm guessing
you could probably do the same with a regular menu.
sub ni_click
{
if ($Window->IsVisible)
{
if ($Window->IsIconic)
{
$menu = new Win32::GUI::Menu(
"&PopUpMenu" => "PopUpMenu",
" > &Hide" => "Hide",
" > &Maximize" => "Restore",
" > -" => 0,
" > M&anual Entry" => "Manual",
" > &Edit entries" => "Edit",
" > &Work Offline" => "WorkOffline1",
" > &Synchronize" => "Synch",
" > -" => 0,
" > &Quit" => "Exit",
);
}
else
{
$menu = new Win32::GUI::Menu(
"&PopUpMenu" => "PopUpMenu",
" > &Hide" => "Hide",
" > &Minimize" => "Minimize",
" > -" => 0,
" > M&anual Entry" => "Manual",
" > &Edit entries" => "Edit",
" > &Work Offline" => "WorkOffline1",
" > &Synchronize" => "Synch",
" > -" => 0,
" > &Quit" => "Exit",
);
}
}
else
{
if ($action eq "Stop")
{
$menu = new Win32::GUI::Menu(
"&PopUpMenu" => "PopUpMenu",
" > &Show" => "Show",
" > S&top \"$descr\"" => "StartStop",
" > -" => 0,
" > M&anual Entry" => "Manual",
" > &Edit entries" => "Edit",
" > &Work Offline" => "WorkOffline1",
" > &Synchronize" => "Synch",
" > -" => 0,
" > &Quit" => "Exit",
);
}
else
{
$menu = new Win32::GUI::Menu(
"&PopUpMenu" => "PopUpMenu",
" > &Show" => "Show",
" > -" => 0,
" > M&anual Entry" => "Manual",
" > &Edit entries" => "Edit",
" > &Work Offline" =>
"WorkOffline1",
" > &Synchronize" => "Synch",
" > -" => 0,
" > &Quit" => "Exit",
);
}
}
}
HTH,
Pete
-----Original Message-----
From: Jez White [mailto:[EMAIL PROTECTED]
Sent: Friday, February 27, 2004 4:41 AM
To: Win32-GUI
Subject: [perl-win32-gui-users] Dynamic popup menus
Hi,
I've searched through the list but am unable to find an answer to the
following question.
I'm trying to create a (static) pop up menu with a dynamic sub menu. As an
example, open internet explorer, then the tools menu. The first item in the
menu is "Mail and News >", I want to make the sub menu dynamic. Has anyone
got any pointers to how this could done?
I'll post a working example if I can get it working.
Cheers,
jez.