Recent

Author Topic: [SOLVED] TBitButton Alignment of Icon and Text  (Read 2967 times)

OLLI_S

  • Full Member
  • ***
  • Posts: 117
[SOLVED] TBitButton Alignment of Icon and Text
« on: October 03, 2018, 03:29:05 pm »
Hello,

I have some TBitButtons on my form (vertically positioned) and they all have a icon.
The Layout is blGlyphLeft so the icon is left and the text if right to the icon.

Is there a way to align the icons and the text of all TBitButtons to the left side?
So all icons are below each other and the text also begins at the same position.

Thank you for your help.

Best regards

OLLI
« Last Edit: October 03, 2018, 10:57:28 pm by OLLI_S »

wp

  • Hero Member
  • *****
  • Posts: 8097
Re: TBitButton Alignment of Icon and Text
« Reply #1 on: October 03, 2018, 04:08:43 pm »
In Delphi, you use the properties Margin and Spacing for that:
- Margin: Distance between edge of the TBitBtn and the icon unless Margin is -1 which centers the icon.
- Spacing: Distance between the icon and the caption unless Spacing is -1 - then the caption is centered within the space following the icon.
Therefore, you can align the icons and captions with Margin > -1 and Spacing > -1 in Delphi.

Unfortunately Lazarus behaves differently:
- Spacing> 0: Distance between icon and caption, both are centered. Margin is ignored
- Spacing = -1: The icon is left-aligned, the caption is centered within the remaining space of the button.
- Margin: does not seem to have any effect.
Therefore, in Lazarus you can only left-align the icons (Spacing > -1), but the text will always be centered.

I think this is a bug (at least on Windows, Laz on gtk2/qt behaves like Delphi). Please report.
« Last Edit: October 03, 2018, 04:37:16 pm by wp »
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

OLLI_S

  • Full Member
  • ***
  • Posts: 117
Re: TBitButton Alignment of Icon and Text
« Reply #2 on: October 03, 2018, 06:29:25 pm »
I think this is a bug (at least on Windows, Laz on gtk2/qt behaves like Delphi). Please report.

I am a beginner that has never reported an issue.
So please tell me where I should report this.
Thank you!

valdir.marcos

  • Hero Member
  • *****
  • Posts: 1020
Re: TBitButton Alignment of Icon and Text
« Reply #3 on: October 03, 2018, 06:57:21 pm »
I think this is a bug (at least on Windows, Laz on gtk2/qt behaves like Delphi). Please report.
I am a beginner that has never reported an issue.
So please tell me where I should report this.
Thank you!
Do it here:
https://bugs.freepascal.org/my_view_page.php

wp

  • Hero Member
  • *****
  • Posts: 8097
Re: TBitButton Alignment of Icon and Text
« Reply #4 on: October 03, 2018, 07:24:25 pm »
So please tell me where I should report this.
I'll report it myself then.

[EDIT]
Done: https://bugs.freepascal.org/view.php?id=34379
« Last Edit: October 03, 2018, 07:41:39 pm by wp »
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

OLLI_S

  • Full Member
  • ***
  • Posts: 117
Re: TBitButton Alignment of Icon and Text
« Reply #5 on: October 03, 2018, 08:49:34 pm »
I'll report it myself then.
[EDIT]
Done: https://bugs.freepascal.org/view.php?id=34379

Thank you very much for reporting this info to the bug tracker.
You described this 1000 times better than I ever could do.

wp

  • Hero Member
  • *****
  • Posts: 8097
Re: [SOLVED] TBitButton Alignment of Icon and Text
« Reply #6 on: October 08, 2018, 12:56:37 pm »
Fixed in current trunk, will be in the upcoming v2.0. Updated http://wiki.lazarus.freepascal.org/TBitBtn
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

OLLI_S

  • Full Member
  • ***
  • Posts: 117
Re: [SOLVED] TBitButton Alignment of Icon and Text
« Reply #7 on: October 08, 2018, 08:40:03 pm »
Fixed in current trunk, will be in the upcoming v2.0. Updated http://wiki.lazarus.freepascal.org/TBitBtn

Cool, when will Lazarus 2.0 be released?
« Last Edit: October 08, 2018, 08:50:15 pm by OLLI_S »

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3969
  • I like bugs.
Re: [SOLVED] TBitButton Alignment of Icon and Text
« Reply #8 on: October 09, 2018, 07:38:18 am »
Cool, when will Lazarus 2.0 be released?
Nobody knows but you can already start to use the fixes branch:
 https://svn.freepascal.org/svn/lazarus/branches/fixes_2_0/
The BitBtn fix will be merged there soon. It will have the latest bug fixes also in future, no need to wait for releases.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

OLLI_S

  • Full Member
  • ***
  • Posts: 117
Re: [SOLVED] TBitButton Alignment of Icon and Text
« Reply #9 on: October 09, 2018, 08:13:57 pm »
Hello JuhaManninen,

thank you, I will wait for the official release of Lazarus 2.0.
The fix is not that serious.

Best regards

OLLI

 

TinyPortal © 2005-2018