RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TShape.ShowHint Property

Determines whether the control displays a Help Hint when the mouse pointer rests momentarily on the control.

Pascal
property ShowHint: Boolean;
C++
__property Boolean ShowHint;

The Help Hint is the value of the Hint property, which is displayed in a box just beneath the control. Use ShowHint to determine whether a Help Hint appears for the control.  

To enable Help Hint for a particular control, the application ShowHint property must be true and either 

the control's own ShowHint property must be true, or 

the control's ParentShowHint property must be true and its parent's ShowHint property must be true. 

For example, imagine a check box within a group box. If the ShowHint property of the group box is true and the ParentShowHint property of the check box is true, but the ShowHint property of the check box is false, the check box still displays its Help Hint. 

Changing the ShowHint value automatically sets the ParentShowHint property to false.  

C++ Examples: 

 

/*
This example uses an edit box and a list box on a form.  
Items are added to the list box and a Help Hint is assigned 
to both controls. The last statement enables the Help Hints
for the entire application.
*/
void __fastcall TForm1::FormCreate(TObject *Sender)
{
  Edit1->Hint = "Enter your name";
  Edit1->ShowHint = true;

  char string[10];
  char index[3];
  for(int i = 1; i <= 10; i++)
  {
    strcpy(string, "Item");
    itoa(i, index, 10);
    strcat(string, index);
    ListBox1->Items->Add(string);
  }
  ListBox1->Hint = "Select an item";
  ListBox1->ShowHint = true;
  Application->ShowHint = true;
}
/*
Note: To see an example that displays the hints of controls
in some place other than in a Help Hint box, see the OnHint
example.
*/

 

Delphi Examples: 

{
This example uses an edit box and a list box on a form.  
Items are added to the list box and a Help Hint is assigned 
to both controls. The last statement enables the Help Hints
for the entire application.
} 
procedure TForm1.FormCreate(Sender: TObject);
var
  I: Integer;
begin
  Edit1.Hint := 'Enter your name';
  Edit1.ShowHint := True;
  with ListBox1 do
  begin
    for I := 1 to 10 do
      Items.Add('Item ' + IntToStr(I));
    Hint := 'Select an item';
    ShowHint := True;
  end;
  Application.ShowHint := True;
end;
{
Note: To see an example that displays the hints of controls
in some place other than in a Help Hint box, see the OnHint
example.
}

 

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!