FMX.MouseOverHints Sample

From RAD Studio Code Examples
Jump to: navigation, search

This sample shows how to use hints to show contextual help.

Location

You can find the MouseOverHints sample project at:

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

  1. Navigate to one of the locations given above and open:
    • Delphi: MouseOverHints.dproj.
    • C++: MouseOverHints.cbproj.
  2. Select the target platform.
    Note: The MouseOverHints sample is supported by desktop platforms, see Platform Support for Hints for further details.
  3. Press F9 or choose Run > Run.
  4. Use the check boxes to change the different options and place the mouse over the buttons, menu items, and panel to see hints.
    MouseOverHints Sample.png

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 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 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 is True, 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.

Uses

See Also