ShowHint (C++)

From RAD Studio Code Examples
Jump to: navigation, search

Description

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.

Code

__fastcall TForm1::TForm1(TComponent* Owner)
  : TForm(Owner)
{
  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.

Uses

Code Samples