kranthi has asked for the wisdom of the Perl Monks concerning the following question:

Hi Perl Monks,
I am implemented MDI Interface. I created a Main window which contains several Child Windows. Now I want to create menus in these Child Windows (as we normally do for child whindows created using the normal Toplevel()), but unable to create menu for the child windows created using MDI.
I searched the CPAN for more details but could not get any information on this topic as the documentation is very limited.
I would like to know is there a way to create a menu for childwindows using MDI Interface, if yes please let me know the procedure for the same?

Replies are listed 'Best First'.
Re: MDI Interface
by GrandFather (Saint) on Aug 26, 2008 at 10:34 UTC

    How about you show us some sample code? Most people who need a GUI for Perl choose Tk, GTk or one of the other cross platform GUI libraries. You may find you get more help if you can switch to one of those GUIs rather than trying to force Perl into the role of a Windows GUI app. Apart from anything else it is generally much quicker to use something like Tk to get a GUI app going with Perl (so long as it doesn't need to look pretty).


    Perl reduces RSI - it saves typing
      Hi Thanks for your quick response. I am using Tk-MDI-0.2 for Perl which is available from CPAN.
      I am sorry for not posting the sample code and here it is.
      use strict; use warnings; use Tk; use Tk::MDI; my $mw = tkinit; my $mdi = $mw->MDI( -style=>'win32', -background=>'gray'); my $child1 = $mdi->add; my $text = $child1->Text->pack; $text->insert('end',"A text widget"); my $child2 = $mdi->add(-titletext=>'Listbox Title'); my $mbar = $child2 -> Menu(); $child2 -> configure(-menu => $mbar); my $submenu = $mbar -> cascade(-label=>"OPTIONS", -underline=>0, -tear +off =>0); $submenu -> command(-label => "FILE", -underline=>0); $submenu -> command(-label => "EDIT", -underline=>0); my $lb = $child2->Listbox->pack; $lb->insert(0,"A Listbox"); MainLoop;

      When I run the above code no error messages received but the menu will not appear in the child Window. Hope you Monks will help me in resolving this issue.

        AFAICT, the child widgets are not exactly windows, but frames that have a window-like appearance and movability, that give them the appearance of windows. As such, adding a menubar isn't going to work anymore than adding one to a button.

        Stop saying 'script'. Stop saying 'line-noise'.
        We have nothing to lose but our metaphors.