How to close a TMultiview from code in Delphi XE8? - delphi

I have a form with a speedbutton linked to a TMultiView component.
On the multiview I have some buttons. When clicking on any of the buttons I want the multiview to close and depending on the clicked button, different functions to be called. I have tried to set the Visible property of my MultiView to false, but the shadow over the form then remains. If I click on the speedbutton again, then menu disappears, and also the shadow, as expected.
Is there a way to solve this?
I'm using Deplhi XE 8.1

Multiview.HideMaster will close the multi view. Call this whenever/wherever you want the multiview to close.

Related

Default Button with VCL Styles

I am puzzled by the styling of TButtons that have Default:=True. The issue is that at least with some styles (Luna, for example), the most recently focused button is highlighted orange, which is the same styling used for a default button. As a result, I am concerned that users might be confused as to which button is the default or will at least think it odd that two buttons are highlighted. This behavior can be seen in XE7 (and according to a comment, also in XE8).
Questions:
Is this considered a modern way (relatively to unstyled VCL) to present default buttons?
If this is not considered standard behavior I can work around it in my own dialogs by strategically enabling/disabling the default button, but I was wondering whether I missed some setting that controls the relation between default buttons and the most-recently focused button. Is there a setting that controls this?
I suspect that this is a VCL styles bug. Create a default VCL application that uses the standard OS theme. Then add two buttons and an edit control. Make one of the buttons be the default button.
Now use the tab key to cycle round the focus. When the edit control has the focus, the default button is highlighted. That indicates that if you press ENTER then that button will be pressed.
However, if either of the buttons has the focus, then the button with the focus is highlighted. That's because if you press ENTER when a button has the focus, the focused button is pressed, irrespective of whether it is the default button.
The rules are as follows:
If a button has the focus, it is highlighted as the default button.
If a control other than a button has the focus, the default button, if there is one, is highlighted.
So, here's what the application looks like in XE7 with the system theme. The non-default button has the focus.
Note that only one button is highlighted, and it is not the default button.
And here is the same application in XE7 with the Luna style.
Here we have the default button, and the button with the focus, both being highlighted. I would regard that to be a bug, and it should be reported.

Is it possible to open a menu when a button is clicked in Rad Studio

It is possible to do in most other environments, but i'm unable to find a way to do this with Embarcadero.
The closest thing that was found is setting the DropDownMenu property on a button with bsSplitButton property... however this has a problem that it only works with Vista (so in fact i cannot even test if it works at all).
Alternatively it is currently possible to add a regular right button drop down.
Is there a way to connect button's left button click event to a specific drop down menu?
Your button's OnClick event handler can call the Popup() method of a TPopupMenu component. You do not have to assign the PopupMenu to the button unless you want it to handle right-clicking.

Change the background color of a button with Delphi XE5 and FireMonkey

I am creating a style for the button component firemonkey, I can even put the rectangle in background but when I run the application the background prevents me click the button. What am I doing wrong? It seems that the rectangle is in front of the button preventing the click. Thank you.
I think your problem is that you need to activate HitTest on the TButton component properties.
With this you solve the problem of the Click event on the TButton component.

Delphi: custom button in custom title bar - à la Firefox/Opera main menu button

I want to create 5 buttons in a title bar of a window using this way: http://delphihaven.wordpress.com/2010/04/19/setting-up-a-custom-titlebar/
Firefox has one button (the same for Opera):
Not maximized window
Maximized window
How to make such buttons for my purpose? Rounded/curved, with bevels, with/without an image, with/without a gradient. Are there similar components? Do I need to make it manually? If so, then how? If it's not a button then what is it? Is there an alternative for it?
For an example of a component that draws on the glass at the top of your form, check out the TRibbon control that comes with Delphi 2010 and above. The source code is included with Delphi. I'd bet that the button is simply an image with an alpha channel. The TRibbon code also draw controls like that on glass.

How do I add buttons to a FireMonkey toolbar?

With 10 years of experience in development, I could not put new buttons on the Toolbar FireMonkey. Could anyone help me?
There is no component editor menu-item to add buttons or seperators, but you can drag buttons from the toolpallet to the toolbar. Or select the toolbar in the form and press F6. Type the name of the control you want on the toolbar and press enter.
TToolBar is now simply a container. You must drop your own controls onto it.
To add a control to a ToolBar, make sure that your ToolBar is selected on the form, select your child control in the Tool Palette, and then click the location in the ToolBar that you wish your child control to appear.
Another way to do this is to ensure that the ToolBar is selected and double-click the control in the Tool Palette. Whatever control is selected becomes the parent.
Many of the new FireMonkey UI controls are now simply containers, including TStatusBar.
To add a text line to TStatusBar, you must add your own TLabel or other control.
I found that the best way to put an image on a button was to literally drop a TImage onto the button and unset the TImage's HitTest property.
All FireMonkey controls are containers and can have child controls now. It might take a little longer to configure your UI, but you have a lot of flexibility.
Use the TLayout control for dividing up the parent control and aligning your controls. Use the Margin and Padding properties to adjust the spacing.

Resources