On 14/02/2008, Jeremy White <[EMAIL PROTECTED]> wrote:
>  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.

I'd be interested in the solution to this!   I thought that the
problem was going
to be the fact that the code got the toolbar height before calling
Autosize(), but
changing that didn't fix it for me.

With the code below I see the toolbar jumping from 1 to 3 rows,
despite the fact that
the buttons only appear on 2 rows, and except for when there is only
one row, the number
of rows is always one too big.

The problem goes away if I make the seperator a real button.  WTF?

Regards,
Rob.

#!/usr/bin/perl -w

use strict;
use warnings;

use Win32::GUI qw(TBSTYLE_BUTTON TBSTATE_ENABLED TBSTYLE_SEP I_IMAGENONE);

my $mw = Win32::GUI::Window->new(
    -size     => [640,480],
    -onResize => \&resizeMW,
);

my $tb = $mw->AddToolbar(
  -multiline => 1,
);

$tb->AddString('Dummy button');

$tb->AddButtons(8,
  I_IMAGENONE, 0,  TBSTATE_ENABLED, TBSTYLE_BUTTON, 0,
  I_IMAGENONE, 0,  TBSTATE_ENABLED, TBSTYLE_BUTTON, 0,
  I_IMAGENONE, 0,  TBSTATE_ENABLED, TBSTYLE_SEP   , 0,
  I_IMAGENONE, 0,  TBSTATE_ENABLED, TBSTYLE_BUTTON, 0,
  I_IMAGENONE, 0,  TBSTATE_ENABLED, TBSTYLE_BUTTON, 0,
  I_IMAGENONE, 0,  TBSTATE_ENABLED, TBSTYLE_BUTTON, 0,
  I_IMAGENONE, 0,  TBSTATE_ENABLED, TBSTYLE_BUTTON, 0,
  I_IMAGENONE, 0,  TBSTATE_ENABLED, TBSTYLE_BUTTON, 0,
);

$tb->AutoSize();

my $tv = $mw->AddTreeView(
  -width => 200,
);

$mw->Show();
Win32::GUI::Dialog();
$mw->Hide();
exit(0);

sub resizeMW {
    my ($self) = @_;

    $tb->AutoSize();

    $tv->Top($tb->Height);
    $tv->Height($self->ScaleHeight - $tv->Top);

    print "TB height: ", $tb->Height(), " Rows: ", $tb->GetRows(), "\n";
  return;
}
__END__

-------------------------------------------------------------------------
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