Hi,

Some good news and some bad news...

The bad. To me the outlook rebar control looks like it contains a toolbar
which contains the icons/text and separators. I have yet to get a toolbar to
work correctly with the rebar...The toolbar control itself has various
methods/features missing (hottrack and separators amongst others).

The Good. You can only have one control per band - however, you can add as
many controls to a child window, which can then be added to a rebar band.
The example below shows this in action.

I've also added some new documentation to rebar.xs (as well as adding a
couple of methods ShowBand and HideBand) and created a tracker item for some
of the issues - feel free to add issues to that tracker item. There is also
a tracker item for the toolbar issues.

http://sourceforge.net/tracker/?group_id=16572

Cheers,

jez.


==============
This example creates 3 bands, band one is empty. Band 2 contains a couple of
drop downs, while band 3 contains a datetime control and a couple of
buttons.


use Win32::GUI;
use strict;

#create the main window
my $mainwindow = new GUI::Window(
    -title    => "Win32::GUI::Rebar test",
    -left     => 100,
    -top      => 100,
    -width    => 600,
    -height   => 200,
    -name     => "Window",
    -onTerminate => sub { return -1 },
);

#create a child window for band 2 of the rebar control, this band will
contain two dropdowns
my $band2 = new Win32::GUI::Window (
    -parent    => $mainwindow,
    -name      => "RebarBand2",
    -popstyle  => WS_CAPTION | WS_SIZEBOX,
    -pushstyle => WS_CHILD,
);

#create the first drop down
my $dd1 = $band2->AddCombobox(
    -name      => "Dropdown",
    -pos       => [0, 0],
    -size      => [100, 80],
    -addstyle  =>  3 | 2097152  | 1048576,
    -tip       => 'Some items',
);

$dd1->Add('Item 1','Item 2','Item 3','Item4');
$dd1->Select(0);

#create the second drop down
my $dd2 = $band2->AddCombobox(
    -name   => "Dropdown2",
    -pos    => [105, 0],
    -size   => [100, 80],
    -addstyle  =>  3 | 2097152  | 1048576,
    -tip       => 'Some colours',
);

$dd2->Add('Red','Blue','Green');
$dd2->Select(0);

#create a child window for band 3 of the rebar control
my $band3 = new Win32::GUI::Window (
    -parent   => $mainwindow,
    -name     => "RebarBand3",
    -popstyle => WS_CAPTION | WS_SIZEBOX,
    -pushstyle => WS_CHILD,
);

# create Date time control for band 3
my $DateTime = $band3->AddDateTime (
    -name     => "DateTime",
    -pos      => [0, 0],
    -size     => [130, 20],
    -tip      => 'A date and time',
);
#set the format for the datetime control
$DateTime->Format('dd-MMM-yyyy HH:mm:ss');

#Add a button to band 3
$band3->AddButton (
         -name     => 'Button',
         -pos      => [135, 0],
         -size     => [50, 20],
         -text     => 'Button',
         -tip      => 'A Button',
         -onClick => sub {print 'button clicked' },
);

#Add a button to band 3
$band3->AddButton (
         -name     => 'Button1',
         -pos      => [195, 0],
         -size     => [50, 20],
         -text     => 'Button1',
         -tip      => 'A Button',
         -onClick => sub {print 'button1 clicked' },
);

#create a rebar control
my $rebar;
$rebar = $mainwindow->AddRebar(
    -name   => "Rebar",
    -bandborders => 1,
    -fixedorder  => 1,
    -onHeightChange => sub {print 'Rebar_HeightChange'.$rebar->Height;},
);

#Insert band 1
$rebar->InsertBand (-text => 'One' );
#Insert band 2
$rebar->InsertBand (
  -child     => $band2,
  -width     => 210,
  -minwidth  => 210,
  -minheight => 21,
);
#Insert band 3
$rebar->InsertBand (
  -child     => $band3,
  -width     => 250,
  -minwidth  => 250,
  -minheight => 21,
);

#show the main window

$mainwindow->Show;

Win32::GUI::Dialog;


----- Original Message ----- 
From: "Chris Wearn" <[EMAIL PROTECTED]>
To: "Win32-GUI List" <perl-win32-gui-users@lists.sourceforge.net>
Sent: Friday, January 23, 2004 2:50 PM
Subject: [perl-win32-gui-users] Rebar - InsertBands - MultipleButtons


> Hi All,
>
> I'm still messing around with rebar, trying to create a menu similar to
the
> rebar in say 'Outlook'. Where a single Band contains a number of buttons
and
> seperators:  | [Reply] [Reply To All] [Forward] | [Send/Receive]| etc
>
> After more tinkering, I've discovered that the button wont accept a -text
> attribute and -bitmap (in that the text wont be rendered). So if you want
a
> bitmap leading the text, you need to create the bitmap with the image and
> the text and put the whole lot on the button.
>
> What I can't figure is how using -child you get more than one button or
> control per Band, or is this not possible.
>
> Chris
>
>
>
> -------------------------------------------------------
> The SF.Net email is sponsored by EclipseCon 2004
> Premiere Conference on Open Tools Development and Integration
> See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
> http://www.eclipsecon.org/osdn
> _______________________________________________
> Perl-Win32-GUI-Users mailing list
> Perl-Win32-GUI-Users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users


Reply via email to