THintInfo is used to define the appearance and behavior of the Help window.
THintInfo = Controls.THintInfo deprecated 'Use Controls.THintInfo';
Controls.THintInfo deprecated 'Use Controls.THintInfo' THintInfo;
The THintInfo type is used to define the appearance and behavior of the Help window in a TShowHintEvent type OnShowHint event handler. The following table describes the meaning of its fields:
Field |
Meaning |
HintControl |
The name of the control for which hint processing is occurring. |
The class of the hint-window control. The default is THintWindow, but you can specify any class derived from THintWindow. Use this field if you want to substitute a custom hint window for THintWindow. | |
HintPos |
The default position in screen coordinates of the top-left corner of the hint window. Change where the window appears by changing this value. |
HintMaxWidth |
The maximum width of the hint window before word wrapping begins. By default, the value is the width of the screen (the Width property of the global Screen variable). |
HintColor |
The background color of the Hint window. |
CursorRect |
The rectangle the user's mouse pointer must be in for the hint window to appear. The default value for CursorRect is the client rectangle of the control. Change this value so that a single control can be divided into several hint regions. When the user moves the mouse pointer outside the rectangle, the hint window disappears. |
CursorPos |
The location of the mouse pointer within the control. |
ReshowTimeout |
How long the hint system should wait before asking about the hint status again. By default, this field is zero, indicating that the hint status will not change. Setting it to a non-zero value will cause the hint to act, after the requested milliseconds have elapsed, as if the user moved the mouse outside the hint rectangle and back in. This can be used to either put off hint processing for a period of time, or to allow the hint to be updated periodically. |
HideTimeout |
The number of milliseconds to show the hint. By default, it is set to the value of the Application variable's HintHidePause property. |
HintStr |
The string to be displayed in the hint window. This allows an OnHint event handler to modify the contents of a hint before it is displayed. By default, it contains the value returned by the GetShortHint function when passed the value of the Application variable's Hint property. |
HintData |
Additional data to be passed to the hint-window control. Use this field in conjunction with HintWindowClass. |
C++ Examples:
/* This example uses three speed buttons on a panel. The code changes the color, width, and position of the text in the Help Hint for the third speed button. Set the ShowHint property of each speed button to true and give a value to the Hint property of each. You must declare the DoShow method in the type declaration of the form. Once it is declared, write the code for the DoShow method in the implementation part of the unit. Finally, in the OnCreate event handler for the form, assign the method to the OnShowHint event of the application. */ void __fastcall TForm1::DoShowHint(UnicodeString &HintStr, bool &CanShow, THintInfo &HintInfo) { if (HintInfo.HintControl == SpeedButton3) { HintInfo.HintColor = clAqua;// Changes only for this hint HintInfo.HintMaxWidth = 120; // Hint text word wraps if width is greater than 120 HintInfo.HintPos.x += SpeedButton3->Width; // Move hint to right edge } } void __fastcall TForm1::FormCreate(TObject *Sender) { Application->ShowHint = true; Application->OnShowHint = DoShowHint; }
Delphi Examples:
{ This example uses three speed buttons on a panel. The code changes the color, width, and position of the text in the Help Hint for the third speed button. Set the ShowHint property of each speed button to true and give a value to the Hint property of each. You must declare the DoShow method in the type declaration of the form. Once it is declared, write the code for the DoShow method in the implementation part of the unit. Finally, in the OnCreate event handler for the form, assign the method to the OnShowHint event of the application. } procedure TForm1.DoShowHint(var HintStr: String; var CanShow: Boolean; var HintInfo: THintInfo); begin if HintInfo.HintControl = SpeedButton3 then begin with HintInfo do begin HintColor := clAqua;{ Changes only for this hint } HintMaxWidth := 120;{Hint text word wraps if width is greater than 120 } Inc(HintPos.X, SpeedButton3.Width); { Move hint to right edge } end; end; end; procedure TForm1.FormCreate(Sender: TObject); begin Application.ShowHint := True; Application.OnShowHint := DoShowHint; end;
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
|
What do you think about this topic? Send feedback!
|