From: Waldemar B. <wb...@sa...> - 2007-08-22 18:16:53
|
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 $TB = $W->AddToolbar(-name=>"Toolbar",); $TB->SetBitmapSize(16, 16); if (( $ARGV[0] ) && ( $ARGV[0] eq 'both' )) { $TB->AddBitmap($both, 1); } else { $TB->AddBitmap($one, 1); $TB->AddBitmap($two, 2); } $TB->AddButtons( 2, 0,0,4,0,0, 1,1,4,0,1, ); $W->Show(); Win32::GUI::Dialog(); exit(0); |
From: Robert M. <rob...@us...> - 2007-08-26 11:21:22
|
On 22/08/07, Waldemar Biernacki <wb...@sa...> wrote: > 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? Sorry, I don't have time to look at this properly, but it looks to me like the code for AddBitmap() is broken - I don't think it should be croak()ing if the toolbar already has an imagelist as it should just add to the end of the list ... Have you tried using an ImageList instead? I'll be back home in a week or so, and have some examples there if you still haven't got anywhere. Regards, Rob. |
From: Waldemar B. <wb...@sa...> - 2007-08-27 04:17:17
|
Thank you Robert!, I tried to do this imageList instead, however documentation is not clear=20 enough for me... :( Temporaly solution is making a serial independent Buttons. Thanks again, Waldemar Dnia niedziela, 26 sierpnia 2007 13:21, Robert May napisa=B3: > On 22/08/07, Waldemar Biernacki <wb...@sa...> wrote: > > 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? > > Sorry, I don't have time to look at this properly, but it looks to me > like the code for AddBitmap() is broken - I don't think it should be > croak()ing if the toolbar already has an imagelist as it should just > add to the end of the list ... > > Have you tried using an ImageList instead? > > I'll be back home in a week or so, and have some examples there if you > still haven't got anywhere. > > Regards, > Rob. |
From: Robert M. <rob...@us...> - 2008-01-27 16:25:29
|
On 26/08/2007, Robert May <rob...@us...> wrote: > On 22/08/07, Waldemar Biernacki <wb...@sa...> wrote: > > 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? > > Sorry, I don't have time to look at this properly, but it looks to me > like the code for AddBitmap() is broken - I don't think it should be > croak()ing if the toolbar already has an imagelist as it should just > add to the end of the list ... OK, I've investigated forther, and made a change to Win32::GUI::Toolbar::AddBitmap(), so that it can be called multiple times to add bitmaps to the toolbar internal image list. You can now replace the relavent part of you code with: if (( $ARGV[0] ) && ( $ARGV[0] eq 'both' )) { print $TB->AddBitmap($both, 2), "\n"; } else { print $TB->AddBitmap($one, 1), "\n"; print $TB->AddBitmap($two, 1), "\n"; } And both paths have the same result. This fix should make it into the next (1.06) release. Regards, Rob. |