Adding the Office 2007 hints to your custom controls with TAdvOfficeHint

Office 2007 hints

All controls that are part of the TMS Advanced toolbars & menus feature an extended Office 2007 style hint. Office 2007 hints are more sophisticated than regular Delphi hints. An office 2007 hint has a title, an optional picture, help text and an optional help line.

This title, help text, picture and optional help line is set through the property OfficeHint which has subproperties:

OfficeHint.Notes: stringlist containing help text
OfficeHint.Picture: BMP, ICO, GIF, JPG or PNG image for the hint. Preferred image type if PNG as the alpha channel is used for transparency
OfficeHint.ShowHelp: When true, an extra line is shown in the hint to suggest to press F1 for help
OfficeHint.Title: sets the title of the hint

To make use of the new hint style, drop the component TAdvOfficeHint on the form and use the OfficeHint property of the components to set hint subject, picture, notes and help line. The regular Hint property is no longer used when a control has an OfficeHint property. Set ShowHint to true when the hint is enabled for a control.

Controls that are not part of the TMS Advanced Toolbars & Menus can be extended with Office 2007 hints as well. Any component that has a property OfficeHint will be recognized by TAdvOfficeHint on the form and TAdvOfficeHint will render the hint as new Office 2007 style with settings as defined in the OfficeHint property.

This code snippet shows the code that was added to extend a custom control with the Office 2007 hint type. Note that the unit AdvHintInfo is added to the uses hint as the TAdvHintInfo class is defined in this unit.


  Classes, AdvHintInfo;


TMyCustomControl = class(TCustomControl)
  FOfficeHint: TAdvHintInfo;
  procedure SetOfficeHint(const Value: TAdvHintInfo);
  constructor Create(AOwner: TComponent); override;
  destructor Destroy; override;
  property OfficeHint: TAdvHintInfo read FOfficeHint write SetOfficeHint;

{ TMyCustomControl }

constructor TMyCustomControl.Create(AOwner: TComponent);
  FOfficeHint := TAdvHintInfo.Create;

destructor TMyCustomControl.Destroy;

procedure TMyCustomControl.SetOfficeHint(const Value: TAdvHintInfo);

From this code, it is clear that adding Office 2007 hints to other controls in your application is straightforward and easy.  Let the Office 2007 fun begin ...