I'm not sure if I understand correctly, but let's see if this helps.
Basically, I think you want to create an imagelist object.
Alterations to the code below.

----- Original Message -----
From: "Waldemar Biernacki" <[EMAIL PROTECTED]>
To: <perl-win32-gui-users@lists.sourceforge.net>
Sent: Wednesday, August 22, 2007 2:15 PM
Subject: [perl-win32-gui-users] How to dynamically combine bitmaps in
toolbar


> Hello everyone!
>
> I've found usefull notes on toolbar. However I have not found how to
> combine
> different images to get one toolbar. Later on is my code. I have three
> bitmaps: one, two and both. If you call the script as follows:
>
> perl script.pl both
>
> then you get two-images toolbar. But if you call
>
> perl script.pl whatever
>
> then you dont get proper toolbar bitmap (Perl complains that it needs a
> list
> and the second addbitmap: $TB->AddBitmap($two, 2); is incorrect.
>
> Is someone able to help me and show how to combine inline bitmaps
> dynamically
> in toolbar?
>
> Regards
>
> Waldemar
>
>
> ###########################################################
> #!/usr/bin/perl
>
> use strict;
> use warnings;
> use Win32::GUI qw();
> use Win32::GUI::BitmapInline ();
>
> my $one = new Win32::GUI::BitmapInline( q(
> Qk02AwAAAAAAADYAAAAoAAAAEAAAABAAAAABABgAAAAAAAADAAATCwAAEwsAAAAAAAAAAAAA////
> ////////////////////////////////////////////////////////////////////////////
> ////////////////////////////////////////////////////////////////////////////
> ////////////////////////////////////////////////////////AAAAAAAAAAAAAAAAAAAA
> AAAA////////////////////////////////////////////////AAAAAAAA////////////////
> ////////////////////////////////////////AAAAAAAA////////////////////////////
> ////////////////////////////AAAAAAAA////////////////////////////////////////
> ////////////////AAAAAAAA////////////////////////////////////////////////////
> ////AAAAAAAA////////////////////////////////////////////////////////AAAAAAAA
> ////////////////////////////////////////////////////////AAAAAAAA////////////
> ////////////////////////////////////////////AAAAAAAA////////////////////////
> ////////////////////////AAAAAAAAAAAAAAAA////////////////////////////////////
> ////////////////////AAAAAAAA////////////////////////////////////////////////
> ////////////////////////////////////////////////////////////////////////////
> ////////////////////////////////
> ) );
> my $two = new Win32::GUI::BitmapInline( q(
> Qk02AwAAAAAAADYAAAAoAAAAEAAAABAAAAABABgAAAAAAAADAAATCwAAEwsAAAAAAAAAAAAA////
> ////////////////////////////////////////////////////////////////////////////
> ////////////////////////////////////////////////////////////////////////////
> ////////////////////////////////////////////////AAAAAAAAAAAAAAAAAAAAAAAAAAAA
> AAAAAAAA////////////////////////////////AAAAAAAA////////////////////////////
> ////////////////////////////////AAAAAAAA////////////////////////////////////
> ////////////////////////AAAAAAAAAAAA////////////////////////////////////////
> ////////////////////AAAAAAAA////////////////////////////////////////////////
> ////////////AAAAAAAA////////////////////////////////////////////////////////
> ////AAAAAAAA////////////////////////////////////////////////////////AAAAAAAA
> ////////////////////////////AAAAAAAA////////////////////AAAAAAAA////////////
> ////////////////AAAAAAAA////////////////AAAAAAAA////////////////////////////
> ////////AAAAAAAAAAAAAAAAAAAAAAAA////////////////////////////////////////////
> ////////////////////////////////////////////////////////////////////////////
> ////////////////////////////////
> ) );
> my $both = new Win32::GUI::BitmapInline( q(
> Qk02BgAAAAAAADYAAAAoAAAAIAAAABAAAAABABgAAAAAAAAGAAATCwAAEwsAAAAAAAAAAAAA////
> ////////////////////////////////////////////////////////////////////////////
> ////////////////////////////////////////////////////////////////////////////
> ////////////////////////////////////////////////////////////////////////////
> ////////////////////////////////////////////////////////////////////////////
> ////////////////////////////////////////////////////////////////////////////
> ////////////////////AAAAAAAAAAAAAAAAAAAAAAAA////////////////////////////////
> AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////////////////////////////////////////
> ////AAAAAAAA////////////////////////////////////////////AAAAAAAA////////////
> ////////////////////////////////////////////////////////AAAAAAAA////////////
> ////////////////////////////////////AAAAAAAA////////////////////////////////
> ////////////////////////////////AAAAAAAA////////////////////////////////////
> ////////////////AAAAAAAAAAAA////////////////////////////////////////////////
> ////////AAAAAAAA////////////////////////////////////////////////////////////
> AAAAAAAA////////////////////////////////////////////////////AAAAAAAA////////
> ////////////////////////////////////////////////////////AAAAAAAA////////////
> ////////////////////////////////////AAAAAAAA////////////////////////////////
> ////////////////////////////////////AAAAAAAA////////////////////////////////
> ////////////AAAAAAAA////////////////////////////////////////////////////////
> ////////////AAAAAAAA////////////////////////////////////////////AAAAAAAA////
> ////////////////////////////////////AAAAAAAA////////////////////AAAAAAAA////
> ////////////////////////////////AAAAAAAAAAAAAAAA////////////////////////////
> ////////////AAAAAAAA////////////////AAAAAAAA////////////////////////////////
> ////////////////AAAAAAAA////////////////////////////////////////////AAAAAAAA
> AAAAAAAAAAAAAAAA////////////////////////////////////////////////////////////
> ////////////////////////////////////////////////////////////////////////////
> ////////////////////////////////////////////////////////////////////////////
> ////////////////////////////////////////////////////////////////////
> ) );
>
> my $W = Win32::GUI::Window->new(-name=>'W',-size=>[400,400],);
>
my $images = Win32::GUI::ImageList->new( 16, 16, 1, 2, 2 );  #added
> my $TB = $W->AddToolbar(-name=>"Toolbar",);
my $TB = $W->AddToolbar(-name=>"Toolbar",-imagelist=>$images);#changed
>
> $TB->SetBitmapSize(16, 16); #extraneous
#already taken care of, in the imagelist declaration
>
> if (( $ARGV[0] ) && ( $ARGV[0] eq 'both' )) {
> $TB->AddBitmap($both, 1);
$images->AddBitmap($both,1); #changed
> } else {
> $TB->AddBitmap($one, 1);
> $TB->AddBitmap($two, 2);
$images->AddBitmap($one,1); #changed
$images->AddBitmap($two,2); #changed
> }
>
> $TB->AddButtons( 2, 0,0,4,0,0, 1,1,4,0,1, );
>
> $W->Show();
> Win32::GUI::Dialog();
> exit(0);
>

Does that help?
Ed Zarger
AG Aegis Company, Inc.


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Perl-Win32-GUI-Users mailing list
Perl-Win32-GUI-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users
http://perl-win32-gui.sourceforge.net/

Reply via email to