Okay, I've rolled back to 0.0.558, and I'm having trouble now adding
anything other than a TextLabel.  Here's my code.  Am I doing something
wrong here?  


use Win32::GUI;
use Win32;
use strict;
$| = 1;

#declare Win32::GUI objects
my $main = Win32::GUI::Window->new(-width => 100, -height => 100, -name =>
'Main', -text => "ZipSD v1.0");
my $font = Win32::GUI::Font->new(-size => 10, -name => "Verdana", -bold =>
1);

#Add controls
$main->AddLabel(                -name => "TestLabel",
                                -text => "This is my text.",
                                -font => $font) || ErrMsg("Couldn't add
Label!"
                                );
                                                                        
$main->AddTextfield(    -name => 'MainText',
                                -prompt => "Enter the path where the files
will be extracted",
                                -text => "c:\\temp") 
                                || ErrMsg("Coudn't add Text Field!");
        

$main->AddButton(               -name => 'OKButton',
                                -align => 'center',
                                -ok => 1) 
                                || ErrMsg("Couldn't add Button!");

#Show Result
$main->Resize(GetClientSize(\$main)) || ErrMsg("Could not resize
Window!\n");

CenterWindow(\$main);
PresentWindow(\$main);


#SUBS
sub GetClientSize{
        my $main = ${$_[0]};
        my $ncw = $main->Width() - $main->ScaleWidth();
        my $nch = $main->Height() - $main->ScaleHeight();
        my $w = $main->TestLabel->Width()
                        + $ncw
                        + $main->OKButton->Width()
                        + $main->MainText->Width();
                        print $main->OKButton->Width()."\n";
        my $h =         $main->TestLabel->Height()
                        + $nch
                        + $main->OKButton->Height()
                        + $main->MainText->Height();
                        print $main->MainText->Height()."\n";
        print "$w, $h\n";               
        return ($w,$h);
}

sub CenterWindow{
        my $main = ${$_[0]};
        my $w = $main->Width();
        my $h = $main->Height();
        my $desk = Win32::GUI::GetDesktopWindow();
        my $dw = Win32::GUI::Width($desk);
        my $dh = Win32::GUI::Height($desk);
        my $x = ($dw - $w) / 2;
        my $y = ($dh - $h) / 2;
        $main->Move($x, $y);
}




sub PresentWindow{
        my $main = ${$_[0]};
        $main->Show();
        $main->Dialog() || ErrMsg("Could not start dialog!\n");
}

sub ErrMsg{
        Win32::MsgBox($_[0],MB_ICONSTOP,"ZipSD Error");
}

Tim Johnson
SanDisk



--------------------------------------------------------------------------------
This email may contain confidential and privileged 
material for the sole use of the intended recipient. 
If you are not the intended recipient, please contact 
the sender and delete all copies.

Reply via email to