Hi,
Rob and I have been trying to track down a couple of issues, and we're not
sure if they are OS or Perl related. We would be greatful if you could run
the two scipts below and report back your findings. When you report back
could you include your OS, Perl and Win32-GUI versions.
Thanks,
jez.
-------------------------
#This crashes on exit with XP (perl 5.6.1 & perl 5.8.7) but not 98
use strict;
use warnings;
use Win32::GUI;
# Create the main window
my $mainwindow = new Win32::GUI::Window(
-name => "Window",
-title => "Objects and Windows",
-pos => [100,100],
-size => [400,400],
);
#We now create several employee selector 'controls'.
my $search1=EmployeeSelector->new($mainwindow,20,20);
my $search2=EmployeeSelector->new($mainwindow,20,50);
my $search3=EmployeeSelector->new($mainwindow,20,80);
my $search4=EmployeeSelector->new($mainwindow,20,110);
my $search5=EmployeeSelector->new($mainwindow,20,140);
$mainwindow->Show();
#Enter the message processing loop
Win32::GUI::Dialog();
exit(0);
package EmployeeSelector;
use strict;
use warnings;
use Win32::GUI;
use base qw(Win32::GUI::Window);
#The constructor
sub new
{
my ($class, $parent, $xcor, $ycor)[EMAIL PROTECTED];
#Create window
my $self = $class->SUPER::new(
-parent => $parent,
-pos => [$xcor,$ycor],
-size => [150, 24],
-popstyle => WS_CAPTION | WS_SIZEBOX,
-pushstyle => WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE,
);
$self->AddButton (
-text => 'Search',
-pos => [60,2],
-size => [60,20],
-tip => 'Search for a Employee ID',
-onClick => sub{$self}, # closure
);
return $self;
}
-------------------------
#!perl -w
#This Causes an error on termination on XP perl 5.6.1 but not on perl 5.8.7
use strict;
use warnings;
use Win32::GUI;
sub I_IMAGENONE() {-2};
sub RDW_INVALIDATE() {1};
my $mw = Win32::GUI::Window->new(
-name => 'MainWindow',
-text => 'CustomDraw',
-pos => [ 100, 100 ],
-size => [ 300, 350 ],
-onActivate => sub { $_[0]->Toolbar->Redraw(RDW_INVALIDATE); return 1; },
-onDeactivate => sub { $_[0]->Toolbar->Redraw(RDW_INVALIDATE); return 1; },
-onTerminate => sub { -1 },
);
my $tb = $mw -> AddToolbar(
-name => 'Toolbar',
-nodivider => 1,
-flat => 1,
-list => 1,
);
for ( 0 .. 3 )
{
$tb->AddString("Test $_");
$tb->AddButtons( 1,
I_IMAGENONE,
1000 + $_,
TBSTATE_ENABLED,
TBSTYLE_AUTOSIZE|TBSTYLE_BUTTON|BTNS_SHOWTEXT,
$_ );
}
$mw->Show();
Win32::GUI::Dialog();
exit(0);
-------------------------