Hi,
 
Thanks for the reply - I probably didn't explain myself to well:) What I was trying to do was something like below:
 
 Show
 -------------
 Manual Entry  >   Manual Entry 1
 Edit entries      Manual Entry 1
 Work Offline      Manual Entry 1
 Synchronize       --------------
 -------------     All
 Quit
 
Where the manual entry sub menu is the dynamic one. Does this make any sense?
 
cheers,
 
jez.
 
----- Original Message -----
From: Peter Eisengrein
To: 'Jez White' ; Win32-GUI
Sent: Friday, February 27, 2004 2:02 PM
Subject: RE: [perl-win32-gui-users] Dynamic popup menus

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:jez@jezwhite.eclipse.co.uk]
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.