Recent

Author Topic: [Solved] How to set TCoolBand heigth?  (Read 1411 times)

Edson

  • Hero Member
  • *****
  • Posts: 1302
[Solved] How to set TCoolBand heigth?
« on: July 10, 2019, 03:35:59 am »
Normally I use ToolBar changing the buttons size and it works OK, but when using ToolBar in a TCoolBar (TCoolband), if I change the ToolBar height, the CoolBand doesn't change and there is not a height property to do it manually.   >:(

Maybe I'm doing something wrong with the CollBar. Suggestions?
« Last Edit: July 11, 2019, 01:21:03 am by Edson »
Lazarus 2.2.6 - FPC 3.2.2 - x86_64-win64 on Windows 10

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: How to set TCoolBand heigth?
« Reply #1 on: July 10, 2019, 01:49:43 pm »
Make sure AutoSize is True and FixedSize is False; TCoolBand should then adapt itself to the height of its contents.
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

Edson

  • Hero Member
  • *****
  • Posts: 1302
Re: How to set TCoolBand heigth?
« Reply #2 on: July 10, 2019, 06:50:27 pm »
Make sure AutoSize is True and FixedSize is False; TCoolBand should then adapt itself to the height of its contents.

TCoolBand doesn't have "Autosize" property and Yes, FixedSize  is false.

TCoolBar have "Autosize" but when set, it adapts to the TCoolBand height (wrong value), not the the ToolBar height.
Lazarus 2.2.6 - FPC 3.2.2 - x86_64-win64 on Windows 10

wp

  • Hero Member
  • *****
  • Posts: 11923
Re: How to set TCoolBand heigth?
« Reply #3 on: July 10, 2019, 07:22:00 pm »
I just tested this to use 32x32 icons in a toolbar inside a CoolBand:
  • Add an image list. Set its Width and height to 32. Add 32x32 png images.
  • Add a toolbar, assign the image list to its Images property. Set its AutoSize to true. The images are still larger than the spacie provided by the toolbar --> Set Toolbar.ButtonWidth and .ButtonHeight to something like 40.
  • Add a TCoolbar, add a CoolBand. Assign the Toolbar to the CoolBand.Controls. Set The Coolbar's AutoSize to true

Edson

  • Hero Member
  • *****
  • Posts: 1302
Re: How to set TCoolBand heigth?
« Reply #4 on: July 11, 2019, 12:19:22 am »
I just tested this to use 32x32 icons in a toolbar inside a CoolBand:
  • Add an image list. Set its Width and height to 32. Add 32x32 png images.
  • Add a toolbar, assign the image list to its Images property. Set its AutoSize to true. The images are still larger than the spacie provided by the toolbar --> Set Toolbar.ButtonWidth and .ButtonHeight to something like 40.
  • Add a TCoolbar, add a CoolBand. Assign the Toolbar to the CoolBand.Controls. Set The Coolbar's AutoSize to true

Good. This make the CoolBand take the height of the ToolBar. But if then you change the Toolbar height:

Code: Pascal  [Select][+][-]
  1.   ToolBar1.ButtonHeight := 25;

The CoolBand doesn't change the height.  :o

But this give me an idea. If the Coolband adapt to the Toolbar height, when set. Then I have to do:

Code: Pascal  [Select][+][-]
  1.  
  2.   ToolBar1.ButtonHeight := 25;
  3.   CoolBar1.Bands[0].Control := nil;
  4.   CoolBar1.Bands[0].Control := ToolBar1;

Every time I want to change the height of the ToolBar.  :D And it works.

I've the feeling this is not the normal behaviour for the Coolbar.
« Last Edit: July 11, 2019, 12:21:08 am by Edson »
Lazarus 2.2.6 - FPC 3.2.2 - x86_64-win64 on Windows 10

wp

  • Hero Member
  • *****
  • Posts: 11923
Re: How to set TCoolBand heigth?
« Reply #5 on: July 11, 2019, 12:30:48 am »
Code: Pascal  [Select][+][-]
  1.   ToolBar1.ButtonHeight := 25;
  2. //  CoolBar1.Bands[0].Control := nil;
  3. //  CoolBar1.Bands[0].Control := ToolBar1;
  4.   CoolBar1.AutoSizeBands;
Try CoolBar1.AutoSizeBands instead of temporarily removing the Toolbar.

Edson

  • Hero Member
  • *****
  • Posts: 1302
Re: How to set TCoolBand heigth?
« Reply #6 on: July 11, 2019, 12:48:40 am »
Thanks. It does the trick.

Now, my next step is how to know put two or more CoolBands in the same row, in design time or in code.
Lazarus 2.2.6 - FPC 3.2.2 - x86_64-win64 on Windows 10

wp

  • Hero Member
  • *****
  • Posts: 11923
Re: How to set TCoolBand heigth?
« Reply #7 on: July 11, 2019, 12:59:29 am »
Set the 2nd CoolBand's Break to false. The Coolbar may become rather stubborn now, it's still better than Delphi's Coolbar, though; you must experiment with Coolband.MinWidth, Toolbar.AutoSize and maybe more.

Edson

  • Hero Member
  • *****
  • Posts: 1302
Re: How to set TCoolBand heigth?
« Reply #8 on: July 11, 2019, 01:12:15 am »
Property "Break" works OK.
Would you know how to avoid the space after and before (and top) of the separator for CoolBands?

I've been working with "GrabWidth" of the CoolBar but it have a bad behaviour.

EDIT. Like usually, I've found it after post the question. It's "HorizontalSpacing".
« Last Edit: July 11, 2019, 01:15:56 am by Edson »
Lazarus 2.2.6 - FPC 3.2.2 - x86_64-win64 on Windows 10

 

TinyPortal © 2005-2018