After playing with this for a while: $TB = new Win32::GUI::Toolbar( $W->Rebar, -name => "Toolbar", -width => 100, -style => 2048 + 8 + 4, -width => 100, -height => 22, -nodivider => 1, # add this to remove the line above the toolbar. );
Joe Frazier, Jr. Senior Support Engineer Peopleclick Service Support Tel: +1-800-841-2365 E-Mail: [EMAIL PROTECTED] ________________________________ From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Chris Wearn Sent: Wednesday, December 01, 2004 7:51 AM To: perl-win32-gui-users@lists.sourceforge.net Subject: [perl-win32-gui-users] Revisited - Rebar and Toolbars Hi All, Have spent a few hours revisiting the old threads regarding the use of the Rebar control. It would appear that you can only have one control per Band, and this was overcome by inserting a borderless window into each band. However, reading the documentation from MSDN and an O'Reilly 'Visual Basic Controls - in a nutshell' on topics for "coolbar" (rebar), it mentions that each band of the rebar control serves as a container and that the most common use is to be placed on an SDI or MDI window, so that multiple TOOLBAR controls can be contained within it, one in each Band object. This then allows as many controls as you need to be placed in the Toolbar, which is then made a Child of the Band. An example that I found, demonstrating this is at the end of this email. I noticed that I could not "AddToolbar" to a Band or Rebar and had to use the 'new' method (as per the example). This method all seems to work fine, even the mouse-over (hot) type image changes work, HOWEVER... If you run the example, you will notice a thin line above the toolbar. This does not appear to be part of the Band or Rebar settings and looks like it may be the BorderStyle of the Toolbar. MS and VB documentation lists a default property of "ccFixedSingle" but should be changed to "ccNone" when used in a Rebar. I have searched all the Win32 API constants I can find, and can't work out how to set or remove this property either as a -borderstyle => 1, method or -style => TB_FIXEDSINGLE (example) style. Anyone have any ideas... or is it missing a bit in the XS ?? Rgds Chris Wearn # ====== Rebar.pl example ============== use Win32::GUI; # just for debugging/testing purposes... use Win32::API; $GetDlgCtrlID = new Win32::API("user32", "GetDlgCtrlID", [N], N); $W = new Win32::GUI::Window( -name => "Window", -text => "Win32::GUI::Rebar test", -left => 100, -top => 100, -width => 200, -height => 300, ); $W->Text("Win32::GUI::Rebar test"); new Win32::GUI::Rebar( $W, -name => "Rebar", -text => "I'm a placeholder", -left => 0, -top => 0, -width => 200, -height => 50, -menu => 33, ); if(!$W->Rebar) { print "Error creating Rebar: ", Win32::GetLastError(), "\n"; } $TB = new Win32::GUI::Toolbar( $W->Rebar, -name => "Toolbar", -width => 100, -style => 2048 + 8 + 4, -width => 100, -height => 22, ); $B = new Win32::GUI::Bitmap("tools.bmp"); $TB->SetBitmapSize(16, 16); $TB->AddBitmap($B, 3); $TB->AddString("One"); $TB->AddString("Two"); $TB->AddString("Three"); $TB->AddButtons( 3, 0, 1, 4, 0, 0, 1, 2, 4, 0, 1, 2, 3, 4, 0, 2, ); $BK = new Win32::GUI::Bitmap("zapotec.bmp"); $W->Rebar->InsertBand( -child => $TB, -width => 16*4, -minwidth => 100, -minheight => $TB->Height*2, -bitmap => $BK, ); $E = new Win32::GUI::Textfield( # $W->Rebar, $W, -name => "Textfield", -text => "Hello world!", -width => 100, -height => 22, -background => [0, 255, 0], -foreground => [255, 0, 0], -menu => 55, ); $W->Rebar->InsertBand( -text => "Text:", -child => $E, -width => 100, -minwidth => 100, -minheight => $E->Height, -background => [0, 255, 0], -foreground => [255, 128, 128], ); $W->AddTextfield( -name => "Info", -left => 0, -top => $W->Rebar->Height, -width => $W->ScaleWidth, -height => $W->ScaleHeight-$W->Rebar->Height, -multiline => 1, ); print "R.BANDCOUNT = ", $W->Rebar->SendMessage(1024+12, 0, 0), "\n"; print "R.ROWCOUNT = ", $W->Rebar->SendMessage(1024+13, 0, 0), "\n"; print "R.ROWHEIGHT = ", $W->Rebar->SendMessage(1024+14, 0, 0), "\n"; $W->Show(); # $W->Rebar->Show(); Win32::GUI::Dialog(); sub Window_Terminate { return -1; } sub Window_Resize { $W->Rebar->Resize($W->ScaleWidth, $W->ScaleHeight); $W->Info->Move(0, $W->Rebar->Height); $W->Info->Resize( $W->ScaleWidth, $W->ScaleHeight-$W->Rebar->Height, ); } sub Toolbar_ButtonClick { my($button) = @_; $W->Info->Text("You pressed the button:\r\n".$button); $i = $GetDlgCtrlID->Call($W->Rebar->{-handle}); print "Rebar.ID = $i\n"; $i = $GetDlgCtrlID->Call($W->Textfield->{-handle}); print "Textfield.ID = $i\n"; } sub Textfield_Change { $W->Info->Text("You typed:\r\n".$E->Text); } sub Rebar_HeightChange { if(exists($W->{Info})) { $W->Info->Move(0, $W->Rebar->Height); $W->Info->Resize( $W->ScaleWidth, $W->ScaleHeight-$W->Rebar->Height, ); } }