TdxCustomStatusBar.OnHint Event
Fires when the mouse pointer enters or leaves a control with a hint assigned.
Declaration
property OnHint: TNotifyEvent read; write;
Remarks
To display hints within the status bar, set the AutoHint property of a text panel to True. By doing so, the panel will display the hint text of the control currently located under the mouse pointer.
The functionality provided by the AutoHint property may not suit your needs. For instance, you may need to display hint text only for specific controls. In this instance, you need to handle the OnHint event of the status bar. This event fires each time the mouse pointer enters or leaves the area of a control that has a hint assigned. Thus, you can obtain the control and provide any text as needed. Also, it is up to you to assign the text to the Text property of the status bar panel where you want to display it.
Note
If the OnHint event is handled, the AutoHint property of text panels is ignored. Panels that have this property set to True simply display the text assigned to their Text property.
The sample code below handles the OnHint event to display control hints within the first panel of the status bar. Hints are displayed only for controls that have the ShowHint property set to False. If the AutoHint property is set to True, control hints are displayed regardless of the hot-tracked control’s ShowHint property value.
procedure TForm1.dxStatusBar1Hint(Sender: TObject);
var
Control: TControl;
begin
Control := Self.ControlAtPos(Self.ScreenToClient(Mouse.CursorPos), True, True);
if Control = nil then
dxStatusBar1.Panels[0].Text := ''
else if not Control.ShowHint then
dxStatusBar1.Panels[0].Text := Control.Hint;
end;