Recent

Author Topic: [Solved] TCoolBar: overlap panels  (Read 3247 times)

zoltanleo

  • Sr. Member
  • ****
  • Posts: 488
[Solved] TCoolBar: overlap panels
« on: November 10, 2014, 04:32:47 pm »
Try to put multiple toolbars on TCoolBar. After moving the panels manually, get the picture That they overlap each other.  :o

How can I fix it?

« Last Edit: November 27, 2014, 09:54:11 am by zoltanleo »
Win10 LTSC x64/Deb 11 amd64(gtk2/qt5)/Darwin Cocoa (Monterey):
Lazarus x32/x64 2.3(trunk); FPC 3.3.1 (trunk), FireBird 3.0.10; IBX by TonyW

Sorry for my bad English, I'm using translator ;)

Blaazen

  • Hero Member
  • *****
  • Posts: 3237
  • POKE 54296,15
    • Eye-Candy Controls
Re: TCoolBar: overlap panels
« Reply #1 on: November 10, 2014, 04:55:35 pm »
Try set proper MinWidth to each band. Also, in trunk, there are methods TCoolBar.AutosizeBands; and TCoolBand.AutosizeWidth;. These methods, together with FixedSize=True should solve it.
Lazarus 2.3.0 (rev main-2_3-2863...) FPC 3.3.1 x86_64-linux-qt Chakra, Qt 4.8.7/5.13.2, Plasma 5.17.3
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.21

Try Eye-Candy Controls: https://sourceforge.net/projects/eccontrols/files/

zoltanleo

  • Sr. Member
  • ****
  • Posts: 488
Re: TCoolBar: overlap panels
« Reply #2 on: November 27, 2014, 09:53:17 am »
Wow  :o

After the Lazarus updating (rev 46993) I wrote such code (see attachment)
Code: [Select]
  with CoolBar1 do
    begin
      Bands[0].Control:= ToolBar1;
      Bands[1].Control:= ToolBar2;

      AutoSize:= True;
      Bands[0].FixedSize:= True;
      Bands[0].MinWidth:= ToolBar1.Width;
      Bands[0].Width:= ToolBar1.Width;

      Bands[1].FixedSize:= True;
      Bands[1].MinWidth:= ToolBar2.Width;
      Bands[1].Width:= ToolBar2.Width;

      AutosizeBands;
    end; 


that works correctly. However, thus I can't change Bands width manually.

Thank you very much
Win10 LTSC x64/Deb 11 amd64(gtk2/qt5)/Darwin Cocoa (Monterey):
Lazarus x32/x64 2.3(trunk); FPC 3.3.1 (trunk), FireBird 3.0.10; IBX by TonyW

Sorry for my bad English, I'm using translator ;)

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11452
  • FPC developer.
Re: [Solved] TCoolBar: overlap panels
« Reply #3 on: November 27, 2014, 09:57:58 am »
I think you should set the minwidth to the sum of width of the icons + the sum of the spaces between the icons and few slack pixels. Not to the toolbar width.

zoltanleo

  • Sr. Member
  • ****
  • Posts: 488
Re: [Solved] TCoolBar: overlap panels
« Reply #4 on: November 27, 2014, 11:11:38 am »
I tried to count TToolBar width manually
Code: [Select]
procedure TForm1.CalcSize;
var
  k: Integer;
  i: Integer;
begin

  k:= ToolBar1.Indent * 2 + 2;
  for i := 0 to Pred(ToolBar1.ButtonCount) do k:= k + ToolBar1.Buttons[i].Width;

  k:= ToolBar2.Indent * 2 + 2;
  for i := 0 to Pred(ToolBar2.ButtonCount) do k:= k + ToolBar2.Buttons[i].Width;
end;

There is no difference
Win10 LTSC x64/Deb 11 amd64(gtk2/qt5)/Darwin Cocoa (Monterey):
Lazarus x32/x64 2.3(trunk); FPC 3.3.1 (trunk), FireBird 3.0.10; IBX by TonyW

Sorry for my bad English, I'm using translator ;)

 

TinyPortal © 2005-2018