Frank, one thing to remember that is not in the current versions of some
docs and some samples programs.  "ALL controls MUST have a -name
attribute" and this must be unique in the program (NOT just the window).
Hopefully, the next version to come out will correct these samples.
Try this:

    use Win32::GUI;
    $main = Win32::GUI::Window->new(
      -name => 'Main',
      -width => 100, 
      -height => 100,
    );
   $main->AddLabel(-text => "Hello, World", -name => 'lblLabel');    #
all I added was the -name attribute.
   $main->Show();
   Win32::GUI::Dialog();

   sub Main_Terminate {
    -1;
   }
 

Enjoy!  One thing, after you have played with the base Win32::GUI for a
while, you should probably try Johan's excelent GuiLoft Designer.  He
has put in properties which are poorly documented, if at all. 

Also, MANY of the samples are currently broke because of missing names
and additionally, I believe they start you in a bad coding habit.
Example:

my $lbl1 = $main->AddLabel(-text => "Hello, World", -name =>
'lblLabel');  
$lbl1->Text('Hello Master!'); # this set sets the text for the above
label to 'Hello Master!'

I would prefer this written as:

$main->lblLabel->Text('Hello Master!');

Now, while both will work, the first just pollutes your namespace
needlessly with variables that you dont need because you can access the
controls using the name instead.  

This is all just my opinion and I could be wrong about anything I said.

Joe Frazier, Jr
Technical Support Engineer
PeopleClick
919-645-2916
[EMAIL PROTECTED]
 



> -----Original Message-----
> From: Frank Stetzer [mailto:[EMAIL PROTECTED]
> Sent: Friday, September 28, 2001 12:41 PM
> To: perl-win32-gui-users@lists.sourceforge.net
> Subject: [perl-win32-gui-users] Absolute newbie Q
> 
> 
> I tried the "Hello, world" script from the Win32::GUI tutorial part 1.
> (This is with yeterday's Active State build and Win32::GUI 0.558
> installed by ppm on Win98SE).  I get the following Windows error:
> 
>    PERL caused an invalid page fault in
>    Module MSVCRT.DLL at 0167:78003b44.
>    Registers:
>    EAX=01824f5c CS=0167 EIP=78003b44 EFLGS=00010246
>      (etc.)
> 
> This is the script (hello.pl)
> 
>    use Win32::GUI;
>    $main = Win32::GUI::Window->new(
>      -name => 'Main',
>      -width => 100, 
>      -height => 100,
>     );
>    $main->AddLabel(-text => "Hello, World");
>    $main->Show();
>    Win32::GUI::Dialog();
> 
>    sub Main_Terminate {
>     -1;
>    }
>       
> I assume I missed some absolute first step in the process...
> I scanned the listserv archive and didn't see anyone else 
> disqualified so early in the game :-)
> ==============================================================
> ==========
> Frank Stetzer, Ph.D.                              [EMAIL PROTECTED]
> Research Support                                  P.O. Box 413
> Information and Media Technologies                Milwaukee, WI 53201
> University of Wisconsin - Milwaukee               (414)-229-4571
> 
> 
> _______________________________________________
> Perl-Win32-GUI-Users mailing list
> Perl-Win32-GUI-Users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users
> 

Reply via email to