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

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.

Related

prevent popup menu of parent control from showing

I assigned a popup menu to the TPageControl because I want to display it when I rightclick a tab.
So that works...
Unfortunately it also shows the popup menu when I right-click within the actual tab sheet.
This I do not want because my ListBox1 in the tab sheet responds to a right-click to execute some code.
So right now it's a mess, the code fires upon rightclick of the listbox but also then displays a popup menu.
How can I nullify this popup menu in the tabsheet or at least within the listbox itself?
ok, Handled := True; was all that was needed in the popup event of the listbox. Thanks Rufo for pointing me in the right direction.

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.

How to make an edit control in fmx transparent and hide its border?

How can I make an edit control in fmx transparent and at the same time hide the borders of the control, so it will blend into the control in the back?
What I am trying to do is to make a small Notes program where, when I double-click a tabitem, it shows an edit control to change the text of the tabitem.
Right click the edit control (let's say Edit1) and click 'Edit Custom Style'.
Expand 'edit1style1'.
Click background:TActiveStyleObject.
Clear the SourceLookup property.

Disable dropdown arrow in a TButton

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?

Mimic outside click on a popup menu

You know how in a popup menu if you click outside of the menu the popup disappears? Well I would like to reproduce that.
Currently I am having a panel created with some components on it when a button is clicked. The panel and sub components go away when you click a certain button on the panel. However I want it to go away if you click anywhere outside of the panel.
I think you would need to install and application-wide mouse message hook, and if your panel is visible and the coordinates of the mouse event are outside of your panel bounds, then hide the panel. Also handle the WM_ACTIVATE message in your form.
[Edited: removed answer involving SetCaptureControl() because the bahaviour is not appropriate in this circumstance]

Resources