Hi,

I've had a play and it seems ok - although I'm having a few problems with
some of the styles - but this could be me:)

The example below creates a toolbar with a few buttons (run in the samples
folder for it to pick up the bitmaps) which are added via image lists.
If I use the SetStyle method (with any style) the toolbar ends up at the
bottem of the window. I've yet to get any functionality working with
SetExtendedStyle (I was trying to get tooltips working with the toolbar
using the text from the buttons).

Just me?

Cheers,

jez.
==============

use Win32::GUI;

$W = new Win32::GUI::Window(
    -title    => "Win32::GUI::Toolbar test",
    -left     => 100,
    -top      => 100,
    -width    => 500,
    -height   => 400,
    -name     => "Window",
);

$B1 = new Win32::GUI::Bitmap("one.bmp");
$B2 = new Win32::GUI::Bitmap("two.bmp");
$B3 = new Win32::GUI::Bitmap("three.bmp");
$IL = new Win32::GUI::ImageList(16, 16, 0, 3, 10);
$IL->Add($B1, 0);
$IL->Add($B2, 0);
$IL->Add($B3, 0);

$TB = $W->AddToolbar(
    -left   =>  0,
    -top    =>  0,
    -width  => 300,
    -height => 100,
    -name   => "Toolbar",
    -addstyle =>  0x0800,
);
$TB->SetImageList($IL);
#$TB->SetStyle(TBSTYLE_FLAT|TBSTYLE_TRANSPARENT);
#$TB->SetExtendedStyle(TBSTYLE_EX_MIXEDBUTTONS|TBSTYLE_EX_DRAWDDARROWS);
$Bh1 = new Win32::GUI::Bitmap("three.bmp");
$Bh2 = new Win32::GUI::Bitmap("one.bmp");
$Bh3 = new Win32::GUI::Bitmap("two.bmp");
$ILhot = new Win32::GUI::ImageList(16, 16, 0, 3, 10);
$ILhot->Add($Bh1, 0);
$ILhot->Add($Bh2, 0);
$ILhot->Add($Bh3, 0);
$TB->SetHotImageList($ILhot);
$TB->AddButtons(
    4,
    0, 1, 4, 0, 0,
    1, 2, 4, 0, 1,
    0, 0, 0, TBSTYLE_SEP, 0,
    2, 3, 4, 0, 2,
);
$TB->AddString("One");
$TB->AddString("Two");
$TB->AddString("Three");

$W->Show;

Win32::GUI::Dialog();


sub Window_Terminate {
    return -1;
}

sub Window_Resize {
    $TB->Resize($W->ScaleWidth-10, 100);
}

sub Toolbar_ButtonClick {
    my($button) = @_;
    print "Toolbar: clicked button $button\n";
}


Reply via email to