Recent

Author Topic: Grouping buttons of toolbar in different group  (Read 6068 times)

simsee

  • Full Member
  • ***
  • Posts: 240
Grouping buttons of toolbar in different group
« on: February 01, 2017, 11:33:06 am »
Dear all, I have a Toolbar menu, with some buttons of style tbsCheck. I need to group them in different groups, but how can I specify the group of each button?

wp

  • Hero Member
  • *****
  • Posts: 13625
Re: Grouping buttons of toolbar in different group
« Reply #1 on: February 01, 2017, 12:25:35 pm »
Work with actions, they have a GroupIndex.

Here are short instructions in case if you never have used actions before: Add a TActionList, doubleclick to open the actionlist editor, "+" for each action, assign code to the OnExecute event, set GroupIndex, usually set AutoCheck to true. Assign the action to the Action property of the toolbutton, menuitem, context menu item which is intended to use this action.

simsee

  • Full Member
  • ***
  • Posts: 240
Re: Grouping buttons of toolbar in different group
« Reply #2 on: February 01, 2017, 12:30:48 pm »
Thanks. I will use this solution.

simsee

  • Full Member
  • ***
  • Posts: 240
Re: Grouping buttons of toolbar in different group
« Reply #3 on: February 01, 2017, 03:11:33 pm »
Another question about same topic (thanks for patience): How divider/separator influence grouping of tbsCheck button in toolbars? It seems to me that set of buttons divided/separated toggle indipendendly? Is correct?

Blaazen

  • Hero Member
  • *****
  • Posts: 3241
  • POKE 54296,15
    • Eye-Candy Controls
Re: Grouping buttons of toolbar in different group
« Reply #4 on: February 01, 2017, 05:21:12 pm »
Dividers and separators are just for visual separation, nothing else. If you need more logical groups, you have to set them different GroupIndex, the first group tbsCheck buttons will have 101, the second 102 etc.
(Numbers 101, 102 have no special meaning, they just must be unique.)
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/

wp

  • Hero Member
  • *****
  • Posts: 13625
Re: Grouping buttons of toolbar in different group
« Reply #5 on: February 01, 2017, 05:29:00 pm »
Blaazen, this was the original question: Toolbuttons don't have a GroupIndex, only a boolean Grouped.

simsee

  • Full Member
  • ***
  • Posts: 240
Re: Grouping buttons of toolbar in different group
« Reply #6 on: February 01, 2017, 06:03:10 pm »
So, divider/separator don't affect grouping, but are useful only for visualization needs. Thanks for explanations.

Blaazen

  • Hero Member
  • *****
  • Posts: 3241
  • POKE 54296,15
    • Eye-Candy Controls
Re: Grouping buttons of toolbar in different group
« Reply #7 on: February 01, 2017, 06:24:28 pm »
@wp

Thanks, really, there's no GroupIndex property on TToolButton.

So there's another way if someone needs more groups: TCoolBar where each band has its own TToolBar.
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/

simsee

  • Full Member
  • ***
  • Posts: 240
Re: Grouping buttons of toolbar in different group
« Reply #8 on: February 01, 2017, 06:43:19 pm »
I did the following experiment (see attach): I inserted two couple of tbsCheck button, all with grouped=true, separated by a divider. Why buttons of each couple toggles indipendently? Seems to me that divider has also a semantic value, partitioning behavior of buttons... May be I'm wrong...

Blaazen

  • Hero Member
  • *****
  • Posts: 3241
  • POKE 54296,15
    • Eye-Candy Controls
Re: Grouping buttons of toolbar in different group
« Reply #9 on: February 01, 2017, 07:24:13 pm »
Yes, your demo work, I was wrong. I tested cbsSeparator too. Both cbsDivider and cbsSeparator logically separates groups of toolbars. I'm sorry for confusion.
Anyway, you can give a try to TCoolBar too.
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/

simsee

  • Full Member
  • ***
  • Posts: 240
Re: Grouping buttons of toolbar in different group
« Reply #10 on: February 01, 2017, 07:54:15 pm »
Don't worry! In fact, I had some problems in grouping with divider in a more complex scenario, with many groups of different check button, where this approach seems to fail. My toolbutton has been modified many times usig visual composer.

I don't know if my problem is due to a bug of tool or of my application (likely the last hypothesis...) From this situation arises my original question. Thanks to all.

 

TinyPortal © 2005-2018