Home › Forums › Konopka Signature VCL Controls (formerly Raize Components) › TRzToolButton Down and tsDropDown
- This topic has 4 replies, 2 voices, and was last updated 2019-02-21 at 2:56 am by Ján Kandrik.
-
AuthorPosts
-
-
February 17, 2019 at 2:45 pm #1102
Hi! I am unable to use TRzToolbar Button GroupIndex (and Down property) together with ToolStyle=tsDropDown. If I set ToolStyle to tsDropDown, I am not able to set GroupIndex to anything else than zero (and therefore also using Down property does not do anything). I have the onClick event implemented (noticed different behavior when it is not implemented). Am I doing something wrong, or is this not possible?
-
February 18, 2019 at 11:04 pm #1109
Hi,
The behavior you are seeing is by design. Let me try to explain. The DropDown style allows a drop-down menu to be associated with the button. So that when you click on the arrow, a popup menu is displayed and the user can select one of the items from the menu. If you have an OnClick event handler (or an Action) assigned to the button, then the drop-down arrow portion is separated from the button itself. This allows you to have the button click perform some default behavior. Think of the File Open button in RAD Studio. The drop-down arrow provides access to a recently used list of files, and the button click displays the Open Dialog.The GroupIndex property is used in situations to allow the button to behave like a check-box or radio button. If the GroupIndex property value is shared across multiple buttons, then only one button in the set can be down at a time. Think of a set of text alignment buttons (Left, Center, Right). Only one of the buttons can be pressed at a time. If the GroupIndex values are unique for each button, then each button can work like a toggle. Think of the Bold, Italics, and Underline buttons.
The AllowAllUp property works with the GroupIndex property to determine if all the buttons in a group (even a group of one) can all be in the Up state, or does one button have to be down.
As a result, having a ToolButton in the DropDown style does not really fit in with the behavior of the grouping.
Ray
-
February 19, 2019 at 6:32 am #1113
Thank you very much for answering. In my use case I actually don’t need the button to be a part of a group, I only use “group of one” to make it work like a Toggle, just like You stated in your answer. I use it for some output filtering – clicking the button turns filtering on/off and by checking items in the dropdown, the user selects what he wants to see. Is there any way to make it work like that? In original Delphi TToolBar this was working correctly, however I was having some high DPI and layout issues so I tried TRzToolbar.
-
February 21, 2019 at 12:12 am #1122
The only way to change the behavior would be to modify the source code for the control. However, a simple alternative would be to use two buttons. One regular tool button with a unique GroupIndex and AllowAllUp set to True. Then use a separate tool button set to tsDropDown style and just resize it to make it thinner. You can even place it right next to the other button.
Ray
-
February 21, 2019 at 2:56 am #1216
Yes, that is one of the ways I tried. Bad thing is that the toolbar maintains some minimum width of a button and it just doesn’t look good. I ended with converting it to be menu only and included a “Show all” item in the menu. Thanks again for your time.
-
-
AuthorPosts
- You must be logged in to reply to this topic.