[perl-win32-gui-users] Multiple ImageList bug

2003-10-26 Thread Steve Pick
Hi,

I have some code that creates two ImageList objects:
our $ARCHIVE = new Win32::GUI::ImageList(64,64,ILC_COLOR32,0,100);
our $ICONS = new Win32::GUI::ImageList(16,16,ILC_COLOR32 | ILC_MASK,0,10);

don't worry about those constants, they're defined at the top of my script
as:
 ILC_COLOR32 => 0x0020,
 ILC_MASK=> 0x0001

A listview is set to use imagelist $ICONS, and another listview is set to
use imagelist $ARCHIVE. However, On adding even one image to $ARCHIVE, both
listviews always show images from $ARCHIVE. In fact $ICONS shows 16x16
segments of 64x64 images added to $ARCHIVE.

I'm adding images to $ICONS and $ARCHIVE like so:
$ICONS->Add(new Win32::GUI::Bitmap("resource/downgreen_i.bmp"),new
Win32::GUI::Bitmap("resource/down_m.bmp"));
# the above is done outside of any subroutine.

$ARCHIVE->Add(new Win32::GUI::Bitmap("archivetemp.bmp"));
# the above is done in an addfilestoarchive function.

I've no idea what's causing $ICONS to always show images from $ARCHIVE.
$ICONS is filled at the start of the application, $ARCHIVE is cleared and
filled whenever the addfilestoarchive sub is called.

Do my bitmap objects need to be persistent or something? I would have
thought perl's garbage collector would realise not to clear the anonymous
bitmap objects created with ImageList::Add.

Help!

Steve Pick
perl-win32-gui-users@lists.sourceforge.net






[perl-win32-gui-users] Additional: Multiple ImageList bug

2003-10-26 Thread Steve Pick
Additional:

print $ARCHIVE."\n".$ICONS."\n";

gives:
Win32::GUI::ImageList=HASH(0x265e044)
Win32::GUI::ImageList=HASH(0x265e044)

Oh dear. Serious bug. They're in the same memory. I'll look at the
Win32::GUI code and see if this is a simple bug that even i can fix.

Steve

- Original Message - 
From: "Steve Pick" <[EMAIL PROTECTED]>
To: 
Sent: Sunday, October 26, 2003 8:12 PM
Subject: Multiple ImageList bug


> Hi,
>
> I have some code that creates two ImageList objects:
> our $ARCHIVE = new Win32::GUI::ImageList(64,64,ILC_COLOR32,0,100);
> our $ICONS = new Win32::GUI::ImageList(16,16,ILC_COLOR32 | ILC_MASK,0,10);
>
> don't worry about those constants, they're defined at the top of my script
> as:
>  ILC_COLOR32 => 0x0020,
>  ILC_MASK=> 0x0001
>
> A listview is set to use imagelist $ICONS, and another listview is set to
> use imagelist $ARCHIVE. However, On adding even one image to $ARCHIVE,
both
> listviews always show images from $ARCHIVE. In fact $ICONS shows 16x16
> segments of 64x64 images added to $ARCHIVE.
>
> I'm adding images to $ICONS and $ARCHIVE like so:
> $ICONS->Add(new Win32::GUI::Bitmap("resource/downgreen_i.bmp"),new
> Win32::GUI::Bitmap("resource/down_m.bmp"));
> # the above is done outside of any subroutine.
>
> $ARCHIVE->Add(new Win32::GUI::Bitmap("archivetemp.bmp"));
> # the above is done in an addfilestoarchive function.
>
> I've no idea what's causing $ICONS to always show images from $ARCHIVE.
> $ICONS is filled at the start of the application, $ARCHIVE is cleared and
> filled whenever the addfilestoarchive sub is called.
>
> Do my bitmap objects need to be persistent or something? I would have
> thought perl's garbage collector would realise not to clear the anonymous
> bitmap objects created with ImageList::Add.
>
> Help!
>
> Steve Pick
> perl-win32-gui-users@lists.sourceforge.net
>
>
>




[perl-win32-gui-users] Fixed: Multiple ImageList bug

2003-10-26 Thread Steve Pick
Me again, sorry for the flood of posts.

Yes, it's a bug in GUI.pm

Win32::GUI::ImageList just uses $self without defining it like:
my $self = {};

So to fix the bug, just find Win32::GUI::ImageList in GUI.pm,
(it's on line 2141 in 0.0.558), and add a definition of $self as
above.

Steve

- Original Message - 
From: "Steve Pick" <[EMAIL PROTECTED]>
To: 
Sent: Sunday, October 26, 2003 8:32 PM
Subject: Additional: Multiple ImageList bug


> Additional:
>
> print $ARCHIVE."\n".$ICONS."\n";
>
> gives:
> Win32::GUI::ImageList=HASH(0x265e044)
> Win32::GUI::ImageList=HASH(0x265e044)
>
> Oh dear. Serious bug. They're in the same memory. I'll look at the
> Win32::GUI code and see if this is a simple bug that even i can fix.
>
> Steve
>
> - Original Message - 
> From: "Steve Pick" <[EMAIL PROTECTED]>
> To: 
> Sent: Sunday, October 26, 2003 8:12 PM
> Subject: Multiple ImageList bug
>
>
> > Hi,
> >
> > I have some code that creates two ImageList objects:
> > our $ARCHIVE = new Win32::GUI::ImageList(64,64,ILC_COLOR32,0,100);
> > our $ICONS = new Win32::GUI::ImageList(16,16,ILC_COLOR32 |
ILC_MASK,0,10);
> >
> > don't worry about those constants, they're defined at the top of my
script
> > as:
> >  ILC_COLOR32 => 0x0020,
> >  ILC_MASK=> 0x0001
> >
> > A listview is set to use imagelist $ICONS, and another listview is set
to
> > use imagelist $ARCHIVE. However, On adding even one image to $ARCHIVE,
> both
> > listviews always show images from $ARCHIVE. In fact $ICONS shows 16x16
> > segments of 64x64 images added to $ARCHIVE.
> >
> > I'm adding images to $ICONS and $ARCHIVE like so:
> > $ICONS->Add(new Win32::GUI::Bitmap("resource/downgreen_i.bmp"),new
> > Win32::GUI::Bitmap("resource/down_m.bmp"));
> > # the above is done outside of any subroutine.
> >
> > $ARCHIVE->Add(new Win32::GUI::Bitmap("archivetemp.bmp"));
> > # the above is done in an addfilestoarchive function.
> >
> > I've no idea what's causing $ICONS to always show images from $ARCHIVE.
> > $ICONS is filled at the start of the application, $ARCHIVE is cleared
and
> > filled whenever the addfilestoarchive sub is called.
> >
> > Do my bitmap objects need to be persistent or something? I would have
> > thought perl's garbage collector would realise not to clear the
anonymous
> > bitmap objects created with ImageList::Add.
> >
> > Help!
> >
> > Steve Pick
> > perl-win32-gui-users@lists.sourceforge.net
> >
> >
> >
>