On 15/02/2008, M2U Germany <[EMAIL PROTECTED]> wrote:
> From: "Jeremy White" <[EMAIL PROTECTED]>
> Sent: Wednesday, February 13, 2008 9:36 PM
> >
> > The cool bar control:
> >
> > http://www.robmay.me.uk/win32gui
> >
> > There is an issue in your code - just ran out of time to fix it! If you
> > can't find it let me know - should have time tomorrow.
>
> Thanks a lot for this helpful link, Jez! I played around with the coolbar
> control a little and it might be a good alternative indeed!
> But my problem persists: I'm still not sure how to merge my toolbar into the
> rebar / coolbar. As I said: If I assign a complete window with a toolbar to
> the re-/coolbar the (manifest-)layout gets disturbed by the window
> background (gray overlay over bluish theme) and if I assign the toolbar
> straight to it the grippers and chevrons disappear...

Try something like the code that I'll attach at the end.  There's some
styles that
need adding to a toolbar before it can be put in a rebar so that the
toolbar stops
trying to resize itself across the top of it's parent window, and
allows the rebar
to correctly size it.

I don't have Vista, so I can't check if I got the styles right to see the theme
background through the toolbar, but I've don it according to MS docs which say:

"If you want your application to match the Microsoft Windows interface,
 use the flat transparent style toolbar."

Regards,
Rob.

# Author: Robert May - [EMAIL PROTECTED]
#
# Copyright (C) 2005 Robert May
#
# This script is free software; you can redistribute it and/or modify
# it under the same terms as Perl itself.

# Demonstration of experimental Coolbar class for drawing a CoolMenu bar.
# Demonstration of other rebar features

use strict;
use warnings;

use Win32::GUI qw(WS_BORDER WS_CAPTION WS_SIZEBOX WS_CLIPCHILDREN WS_CHILD
                  RBBS_CHILDEDGE RBBS_FIXEDBMP RBBS_BREAK
                  TBSTATE_ENABLED TBSTYLE_AUTOSIZE TBSTYLE_BUTTON
                  BTNS_SHOWTEXT
                  I_IMAGENONE
);

# constants
sub RBBS_USECHEVRON()   {512};
sub CCS_NOPARENTALIGN() {8};
sub CCS_NORESIZE()      {4};

# Create a main window
my $mw = Win32::GUI::Window->new(
  -title    => "Transparent toolbar Demo",
  -pos      => [100,100],
  -size     => [500,300],
  -onResize => \&mwResize,      # resize the rebar, so that chevrons
appear when window is too narrow
);

# Create a Rebar
my $rb = $mw->AddRebar(
  -pushstyle   => WS_BORDER,
  -bandborders => 1,
);

# Create a Toolbar, ready to insert into the Rebar
my $tb1 = Win32::GUI::Toolbar->new(
    -parent => $rb,
    -nodivider => 1,
    -flat => 1,
    -list => 1,
    -transparent => 1,
    -pushstyle => CCS_NORESIZE | CCS_NOPARENTALIGN,   # these style
mandatory if you want it to look right
);
$tb1->AddString("Button 1");
$tb1->AddString("Button 2");

$tb1->AddButtons(
  2,
  I_IMAGENONE, 5, TBSTATE_ENABLED,
TBSTYLE_AUTOSIZE|TBSTYLE_BUTTON|BTNS_SHOWTEXT, 0,
  I_IMAGENONE, 6, TBSTATE_ENABLED,
TBSTYLE_AUTOSIZE|TBSTYLE_BUTTON|BTNS_SHOWTEXT, 1,
);

$rb->InsertBand(
    -child => $tb1,
    -width => ($tb1->GetMaxSize())[0],
    -minwidth => ($tb1->GetItemRect(0))[2],
    -minheight => ($tb1->GetMaxSize())[1],
    -style => RBBS_CHILDEDGE | RBBS_FIXEDBMP,
    -idealwidth => ($tb1->GetItemRect($tb1->ButtonCount()-1))[2],
);

# And a second toolbar so we have 2 bands
my $tb2 = Win32::GUI::Toolbar->new(
    -parent => $rb,
    -nodivider => 1,
    -flat => 1,
    -list => 1,
    -transparent => 1,
    -pushstyle => CCS_NORESIZE | CCS_NOPARENTALIGN,   # these style
mandatory if you want it to look right
);
$tb2->AddString("Button 1");
$tb2->AddString("Button 2");

$tb2->AddButtons(
  2,
  I_IMAGENONE, 5, TBSTATE_ENABLED,
TBSTYLE_AUTOSIZE|TBSTYLE_BUTTON|BTNS_SHOWTEXT, 0,
  I_IMAGENONE, 6, TBSTATE_ENABLED,
TBSTYLE_AUTOSIZE|TBSTYLE_BUTTON|BTNS_SHOWTEXT, 1,
);

$rb->InsertBand(
    -child => $tb2,
    -width => ($tb2->GetMaxSize())[0],
    -minwidth => ($tb2->GetItemRect(0))[2],
    -minheight => ($tb2->GetMaxSize())[1],
    -style => RBBS_CHILDEDGE | RBBS_FIXEDBMP,
    -idealwidth => ($tb2->GetItemRect($tb2->ButtonCount()-1))[2],
);

# show the main window ...
$mw->Show();

# ... and enter the dialog phase.
Win32::GUI::Dialog();
exit(0);

# Resize the rebar to be the width of the window.
sub mwResize
{
  my $self = shift;

  $rb->Width($self->ScaleWidth);
  return 1;
}

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
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