TAdvToolBar - how to vertically centre controls

label

I'm trying to swap over from ToolBar2000 to use the TMS TAdvToolBar components and I'm struggling when trying to add non TAdv* components onto the toolbar, such as TComboBox/TLabel.

The main issue is that it's not possible to size the controls and they are always top aligned. I'm using TAdvToolBar and TAdvTopolDock, where I've read that there's no way to not have the controls aligned automatically.

I see one possible solution is to have controls within TAdvToolBarContainer. The main issue I have with this is that it does not seem possible to remove the border of the container. If this was possible then it would make a better solution for me.

As a workaround for now, you could add a TPanel to the TAdvToolBar.

To make this more convenient, we have:

  1. Made AdvToolBar.AutoPositionControls take AlignWithMargins and Margins in account
  2. Added TAdvToolBarContainer.ShowBorder: boolean to make it possible to turn it off

Both enhancements will be in the next TMS VCL UI Pack update

Great, thanks.

Any idea why TLabels with ParentColor=true and Transparent=true are still appearing in grey when on a toolbar/container like above?

When I drop a default TLabel on the toolbar , it has ParentColor = true and Transparent = true but here I cannot see that it has a gray background.
How exactly can this be reproduced with the latest version of the components?

I'm running BCB2007 with project setting 'Enable Runtime Themes = false'

I'm using a fairly recent version - TAdvToolBar v6.7.1.6

The label displays fine in design time, but at runtime is grey like the pic above.

With 'Enable Runtime Themes = true' the label is transparent. We can't run with that at the moment due to use of older controls.

This is a TLabel issue / shortcoming.
You will even see such problem with a TLabel used on other parent controls.

How strange. I thought I would have seen that behaviour before. A quick test on a panel gives this at runtime:

TLabel

What's a suitable TMS label to use?

I did test TLabel on a form with form color set to clWhite and the label is still showing with a clBtnFace background, even when it is set to transparent.
As alternative, you could try our THTMLabel.

  1. Made AdvToolBar.AutoPositionControls take AlignWithMargins and Margins in account
  2. Added TAdvToolBarContainer.ShowBorder: boolean to make it possible to turn it off
    <<

I see the ShowBorder option works - thanks.

My TAdvOfficeComboBox is still hugging the top of the Toolbar though. I have

AlignWithMargins=true,
Margins.Top = 5

TAdvToolBar.AutoPositionControls=true.

Did this tweak make it into this release?

I could not see an issue here.
This is a TAdvToolBar having a TAdvOfficeComboBox with AlignWithMargins = true and its margins configured:

Please make sure you use the latest release and try starting with this basic setup as shown here and see what you are doing different from this.

I'm running the release from 9th Oct.

On a new form I added a new toolbar and left the default values. I increased the size of the default buttons and then wanted to vertically centre the combo so increased the top margin and set AlignWithMargins=true. Nothing changed. See property values of the combo below.

What 'Auto' settings are enabled on the toolbar in your example?

Please send a project. I think you can understand you cannot expect that I will scan & replicate all property settings from a screenshot and hereby missing all property settings of the TAdvToolBar and other controls when you can simply copy & paste DFM contents here.

object Form17: TForm17
Left = 0
Top = 0
Caption = 'Form17'
ClientHeight = 1128
ClientWidth = 1150
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 13
object AdvDockPanel1: TAdvDockPanel
Left = 0
Top = 0
Width = 1150
Height = 45
MinimumSize = 3
LockHeight = False
Persistence.Location = plRegistry
Persistence.Enabled = False
UseRunTimeHeight = False
Version = '6.8.0.0'
object AdvToolBar1: TAdvToolBar
Left = 3
Top = 1
Width = 174
Height = 30
UIStyle = tsOffice2019White
AllowFloating = True
Caption = 'Untitled'
CaptionFont.Charset = DEFAULT_CHARSET
CaptionFont.Color = clWindowText
CaptionFont.Height = -11
CaptionFont.Name = 'Tahoma'
CaptionFont.Style = []
CompactImageIndex = -1
TextAutoOptionMenu = 'Add or Remove Buttons'
TextOptionMenu = 'Options'
ParentOptionPicture = True
ToolBarIndex = -1
DesignSize = (
174
30)
object AdvToolBarButton2: TAdvToolBarButton
Left = 9
Top = 2
Width = 15
Height = 26
Appearance.CaptionFont.Charset = DEFAULT_CHARSET
Appearance.CaptionFont.Color = clWindowText
Appearance.CaptionFont.Height = -12
Appearance.CaptionFont.Name = 'Segoe UI'
Appearance.CaptionFont.Style = []
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
ParentFont = False
Position = daTop
Version = '6.8.0.0'
end
object AdvToolBarButton3: TAdvToolBarButton
Left = 145
Top = 2
Width = 15
Height = 26
Appearance.CaptionFont.Charset = DEFAULT_CHARSET
Appearance.CaptionFont.Color = clWindowText
Appearance.CaptionFont.Height = -12
Appearance.CaptionFont.Name = 'Segoe UI'
Appearance.CaptionFont.Style = []
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
ParentFont = False
Position = daTop
Version = '6.8.0.0'
end
object AdvOfficeComboBox1: TAdvOfficeComboBox
AlignWithMargins = True
Left = 24
Top = 2
Width = 121
Height = 19
Margins.Top = 7
Button.Color = clWhite
Button.ColorTo = clWhite
Button.ColorHot = 15917525
Button.ColorHotTo = 15917525
Button.ColorDown = 14925219
Button.ColorDownTo = 14925219
Button.Width = 12
BorderColor = 10724259
BorderHotColor = 14925219
SelectionColor = 15914434
SelectionColorTo = 15914434
SelectionTextColor = 3881787
Version = '1.6.1.0'
Anchors = []
ItemIndex = -1
ItemHeight = 14
TabOrder = 0
end
end
end
end

After pasting this in the form designer, I get:

image

So, I can only suspect you do not have the latest version installed.

Definitely the latest installed:

TAdvToolBar v6.8.0.0
TAdvOfficeComboBox v1.6.1.0

I'll stick the combo in a container now that it's possible to remove the container border.