The code I provided is the entire program I have written. I made it only to try making a new window appear by clicking on a menu item. Later I will implement it in my main project. It's a program that searches for open reading frames in DNA sequences (bioinformatics course assignment). I thought it would be a cool addition to embed it in a user interface rather than just a plain black/white console. The code above spawns the main window with menubar. This menubar has 1 menubutton (Menu) which has 2 menu items (Quit and About). The Quit item works like it should, it closes the main window. The About item should spawn the secondary MessageBox window, but it does nothing with I click it. I later put the entire messagebox in a sub:
sub MessageBox{ 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], ); $MessageBox_About->DoModal(); return 0; }
And changed MenuButton1_About to:
my $MenuButton1_About = $MenuButton1->AddMenuItem( -text => "About", -id => $Menu_id++, -onClick => MessageBox(), );
The about messagebox does appear now (A window with label Blabla and an OK button) but right at the start of the program (without clicking on the about menuitem). After clicking on Ok or terminating the window, the main window pops up. When clicking the about menuitem it gives the following error: Undefined subroutine &main::0 called at xx.pl line 127 (even though the program only has 118 lines).

In reply to Re^2: win32::GUI help by thomaster
in thread win32::GUI help [solved] by thomaster

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.