How to set the selective captions for TActionToolbar? - delphi

I have a TActionToolbar...But there's one "feature" I can't quite figure out how to control.
From the customize dialog (Vcl.CustomizeDlg.TCustomizeDlg) for a TActionToolbar. Note the caption options listbox:
So how exactly do you use selective captions? Right now it appears to be identical to "full" captions, as I can't seem to piece together how you tell Delphi which buttons should display selective captions (or what the selective caption wording should be if it is customizable)
TAction doesn't seem to have any properties that appear to relate to selective captions. The description and examples for TCaption didn't seem to get any hints either.
...Or is this just one of those cases where Delphi is showing some sort of standard windows dialog including features Delphi doesn't actually support?

So how exactly do you use selective captions?
As the same suggests it, it allows to have some buttons showing their caption and some others to don't show it.
Once you've set the action in your toolbar, click on the button. Then go in the inspector and go to the property "ShowCaption" and set it to false. For each button you will do that, the caption will be hidden.
I will try to place a graphic here showing that.
1-click the tool button
2-go to the object inspector
3-see the "ShowCaption" property and set it to "false"
4-then see the result, the first button is now showing its caption
I use that from time to time to gain some space on a toolbar with too much button to hide the caption on some obvious button.

Related

Removing Formatting from Text Box Controls - InfoPath

I'm working in InfoPath and somehow created about 16 Text Box Controls with formatting that I cannot override in terms of text size as well as strikethroughs. Any suggestions to be able to remove the formatting and be able to maintain these controls?
It sounds like you got into the code and accessed the toolbar. If you right click on the textbox and go to properties it should take you to the properties window. Make sure under the space next to "Text" in the properties window is blank.

How do I prevent menu and toolbar clicks stealing focus from a floating form?

I want to achieve the same effect as in Visual Studio 2010+, where if you float an editor on top of the main form, clicking on a main form menu or toolbar button doesn't cause the main form to steal focus; instead the floating window retains focus.
Without this it becomes impossible to invoke any main menu command that operates on a focused control when the focused control is in a floating window - because the control you wanted to operate on loses focus just as the command is invoked.
(Ironically, if you look closely at this image you'll see that the selection in the editor is muted, indicating that the editor control doesn't have focus. Visual Studio seems to be doing something slightly devious to achieve the illusion that the floating window is still focused.)
The solution is very easy if you are using TActionMainMenuBar and TActionToolBar.
First the menu bar: TActionMainMenuBar has a property AutoFocus, which is True by default. Set this to False and then clicking on the menu won't automatically give focus to the form containing the menu. Instead, the form that previously had focus will retain it.
Now the tool bar: TActionToolBar doesn't have an AutoFocus property. Instead you need to handle its OnMouseActivate event and return maNoActivate.
Note that returning maNoActivate from an OnMouseActivate handler doesn't work for all controls. Some controls such as TButton will give themselves the focus when clicked regardless of the return result from the OnMouseActivate handler. But in the case of TActionToolBar we do get the effect we are after.
It took me a while to find this though, and even searching Google for a page containing both 'AutoFocus' and 'OnMouseActivate' elicits no useful results (other than, presumably, this page once it gets indexed). So I hope this answer will help someone else.

How to make ComboBox drop-down button invisible in Delphi?

Is there some easy way to customize a ComboBox from Delphi to make the dropdown button with the arrow invisible? I mean without a lot of custom-draw code.. Maybe there is some control specific windows flag to set.
If I understand you correctly, you want all the functionality of the cxDBLookupComboBox, just not the button.
Try this in the FormCreate:
cxDBLookupComboBox1.Properties.Buttons.Clear;
You can access other combo box buttons properties via non-published Buttons property just like that.

Caption for TTabControl

I'm looking for a way of implementing a sort of inset caption before a set of tabs, something like this:
The tab set is not supposed to be multi-line, will only be horizontal and laid out at the top. However it should be correctly scrollable when there are too many tabs.
I fear I'm going to be restricted here with regard to using third-party controls, but I could use subclassing on the standard TTabControl to add the necessary changes to the standard looks and behaviour. (I don't need it to be TPageControl, because it's only the specific arrangement of the tabs that I am interested in.)
Maybe there's some way of implementing this with craftily arranged combination of standard controls, which, despite my endevours, has escaped me.
Basically, any ideas or pointers are welcome.
Oh, and additional requirement is, it should blend well with desktop themes.
Granted some time has passed, but I recently needed this style and found you can do it with the TMS Software TAdvOfficePager. It has a property FixedTabs, which I set to 1 in this case. It also has an OnChanging event where you can prevent access to a tab, in this case I used AllowChange := (ToPage > 0); Lastly, I set the first tab to disabled.
Then just style the first tab different than the rest and you can have something like this:
Have you tried to make the first tab to be the caption you want.
With some additional logic you can restrict the selection of this tab.
I don't know if you can control the style of each tab individually to make the first one look as it is not the tab.
Here is crafty arrangement of controls that will work. I have done this sort of thing in the past. Best of all it automatically handles scrolling of tabs.

How to set the glyph for a toolbar button to blank?

I add a toolbar with some standard Delphi components to my application. Unfortunately, the stupid arrow is first glyph (does anyone even know what it is for?)
I would like to destroy it totally, or, at least, set itcs icon to blank, so that it blends in with the toolbar.
How can I do this?
I need some code which can be executed twice without causing an exception. Thanks
TToolButton gets its image from combining its ImageIndex property with the enclosing toolbar's Images property, which refers to a TImageList. To make a toolbar button have no image, assign ImageIndex := -1.
To remove the glyph from a TSpeedButton at design time, select the button, and then select the Glyph property in the Object Inspector. Press Del to clear the property. To do the same at run time, assign Button.Glyph := nil.
If you have a pre-made toolbar, such as TMediaPlayer or TDBNavigator, then you can't customize the buttons. They always show the arrow glyphs that are hard-coded in the control. You can choose to hide or show certain buttons, though. If you placed the control just to get a row of buttons and have no intention of using them to play media or navigate a database, then don't use that control. Just place a TPanel and put standalone buttons on it.

Resources