FMX.MouseOverHints Sample
This sample shows how to use hints to show contextual help.
Contents
Location
You can find the MouseOverHints sample project at:
- Start | Programs | Embarcadero RAD Studio Athens | Samples and then navigate to:
Object Pascal\Multi-Device Samples\User Interface\MouseOverHints
CPP\Multi-Device Samples\User Interface\MouseOverHints
- Subversion Repository:
- You can find Delphi and C++ code samples in GitHub Repositories. Search by name into the samples repositories according to your RAD Studio version.
Description
The MouseOverHints sample demonstrates how to use hints to show contextual help.
The sample shows how to work with hints, and the special behavior that some components, such as status bars, actions, and menus, have when working with hints.
How to Use the Sample
- Navigate to one of the locations given above and open:
- Delphi: MouseOverHints.dproj.
- C++: MouseOverHints.cbproj.
- Select the target platform.
- Note: The MouseOverHints sample is supported by desktop platforms, see Platform Support for Hints for further details.
- Press F9 or choose Run > Run.
- Use the check boxes to change the different options and place the mouse over the buttons, menu items, and panel to see hints.
Files
File in Delphi | File in C++ | Contains |
---|---|---|
MouseOverHints.dproj |
MouseOverHints.cbproj |
The project itself. |
MouseOverHints.fmx |
MouseOverHints.fmx |
The main form where the components are located. |
MouseoverHintsForm.pas |
MouseoverHintsForm.h, MouseoverHintsForm.cpp |
Used to define and implement the sample. |
Implementation
Setting and Showing Hints
- The TControl.Hint property is used to set the hint of a control in the Object Inspector at design time. The TControl.Hint property is also used to change or set the hint of a control at run time.
- The TApplication.ShowHint property is used to enable or disable the hints for the sample application. Disabling the hints of the application disables the hints from all controls.
- The TForm.ShowHint property is used to enable or disable the hints of the form.
- The TControl.ShowHint property is used to enable or disable the hints of a control.
- The TControl.ParentShowHint property is used to set whether the ShowHint of a control is enabled or disabled according to the TControl.ShowHint property of the parent control.
- The TApplication.HintShortCuts property is used to indicate if the hints also display the keyboard shortcuts.
- The GetLongHint method is used to get the long version of the hint. The long version of the hint is the one written after the | (pipe) character.
See more information about enabling hints.
Actions
The TActionList component is used to maintain a list of some of the actions used in the sample.
- The TAction.OnHint event is used to set or change the hint of the client control. Setting the hint with
OnHint
changes the hint that displays by default.
See more information about actions and hints.
Status Bar
The TStatusBar control works in a different manner for hints.
- The TStatusBar.AutoHint property is set to
True
to allow the status bar to intercept all hints from the application. - Since
TStatusBar.AutoHint
isTrue
, the TStatusBar.OnHint event occurs when any hint in the application is triggered. - The TApplication.Hint property is used to get the text of the current hint.
See more information about status bar and hints.
Menu
Since the menu items do not display hints as other controls do, the Label1
displays the hints of the menu items when the TStatusBar.OnHint event occurs.
See more information about menus and hints.