Disable dropdown arrow in a TButton - delphi

In Delphi(XE5), you can set the style property to "bsSplitButton" to create a split button, add a dropdown arrow and assign a popup menu(DropDownMenu) to it,
but how can i disable the the drop down arrow without disabling the whole button?

Related

Add dropdown button to component

I want to add a dropdown button which usually works as an expand / collapse button in a treegrid. I can't seem to find in the documentation how to add a button which is the exact width and height of the dropdown button, e.g. the specific (custom) button class. This dropdown button should be added to a cell component even if it cannot be expanded / collapsed. The outcome should be that the button in the circle should also be present in the place of the x marks.
I am not fully sure in which context you are going to use this button, but here is an example of borderless button, with html caption that uses the same styles than TreeGrid uses for collapse button.
Button btn = new Button();
btn.addStyleNames("v-treegrid-expander","collapsed");
btn.addStyleName(ValoTheme.BUTTON_BORDERLESS);
btn.addClickListener(event -> {
btn.removeStyleName("collapsed");
btn.addStyleName("expanded");
});
layout.addComponent(btn);

How do I 'revert to inherited' if control is not clickable?

Assume the following situation:
FrmBase has a TPanel named PnlClient, align alClient
FrmDescendant inherits from FrmBase
In FrmDescendant I change a PnlClient property
In FrmDescendant I place another control (say another TPanel named PnlDescendant) on PnlClient and align it alClient.PnlDescendant now completely covers PnlClient
I place lots of other components on PnlDescendant, not necessarily aligned, so I'm afraid to change PnlDescendant (e.g. setting align to alNone and resizing) and lose positions
How can I execute 'revert to inherited' for PnlClient?
There's nothing in the main menu, or in the popup menu for the controls in the Structure View...
Currently using Delphi 10.4.1 Sydney
This is easy for a keyboard user like myself:
Click on PnlDescendant in the form editor to make it the focused and selected control.
Press Esc to select its parent, PnlClient.
Press the Menu key on your keyboard to display the context menu of PnlClient. If you have a cheap keyboard without a Menu key, press Shift+F10 instead.
Click on "Revert to Inherited". (Or, much faster: press the menu item's underlined character, probably I.)
(But notice that this will remove PnlDescendant completely. Probably you didn't want that, but that's how it works.)

How to have a list of options when clicking a TButton on Firemonkey?

I know that TButton on firemonkey let me add a TPopUp Menu. But it only works when you right click it.
I need make it open right below the button when you do the normal click.
PopupMenu.PopUp(X, Y) is based on the form I believe. How to translate the X,Y of the button (that is deep inside other layouts) to the same coordinate?
And when clicking and the PopUp is shown some weird behavior happens with the selection bar of the popup menu that disappear. The button keeps pressed, that is good.
Look here:
http://blogs.embarcadero.com/sarinadupont/2013/10/17/463/
Is an example for mobile, but you use in desktop too.

FireMonkey: how to suppress default popup menu

I've got a TMemo with an associated TPopupMenu on a FireMonkey form.
When I rightclick on the memo, I get my own popup menu, but after my popup disappears I still get the default popup (the one that says cut, copy, paste, select all).
How do I disable the default menu, or can I add my own items to the default menu perhaps?
I can't reproduce this behavior. Here's what I tried:
File->New->FireMonkey HD Application
Drop a TMemo and TPopupMenu on the form
Assign PopupMenu to Memo1.PopupMenu in the Object Inspector
Create two menu items in the PopupMenu, and assign them both the same OnClick event (generated in the Object Inspector). I left the default caption of MenuItem1 and MenuItem2 in the Caption of both items.
Wrote a simple MessageDlg that displays TMenuItem(Sender).Caption with a single Ok button in the OnClick handler.
Run the application, right-click Memo1, and choose either menu item
I get a single menu displayed with my two items (MenuItem1 and MenuItem2). Choosing either item displays the appropriate Caption in a message dialog, and clicking Ok in that dialog. There is no default popup menu displayed.
EDIT: Found it for you. This is a bug fixed in Update 3 - see the list of bug fixes in Update 3, and search for 98705, or scroll through until you reach the section on FireMonkey\Components (it's the second or third entry under that section).

Why doesn't clicking on my TToolButton show the DropdownMenu?

I'm using Delphi 2010 and I have a TToolButton contained by a TToolBar. Assigned to the 'DropdownMenu' property of my TToolButton is a standard TPopupMenu.
The only way I can get the menu to appear is to click on the area pointed to by the red arrow in the image. Currently, clicking the area pointed to by the green arrow shows the button as pressed, but the dropdown menu does not appear.
What I want is if the user clicks anywhere (pointed to by green arrow or red arrow) for the menu to appear. Is it possible to enable this functionality?
The idea of the tbsDropDown style is to have a button that triggers some default action when clicked, but provides more variations of that action in the drop down menu.
If you don't care about the down arrow disappearing, you can set the style to tbsButton and no matter where the button is clicked, it will show the popup menu.
If you are like me and you do want to have the arrow there to indicate that there are more options behind this button, you can call CheckMenuDropdown in the button's OnClicked event handler.
Set Style to tbsButton. Then you can click anywhere to show the drop-down menu, but you will lose the arrow.

Resources