ControlsGetShortHint (Delphi)

From RAD Studio Code Examples
Jump to: navigation, search

Description

This code assigns a two-part string to the Hint property of an edit box and then displays the "short" or first part of the string as the text of the edit box. This example requires a button, a test edit, and a status bar. Set the AutoHint property and the SimplePanel property to True for the status bar. Set the ShowHint property to True for the text edit and the form. Notice that the short hint is used for the text edit hint and the long hint is used for the status bar.

Code

procedure TForm1.BitBtn1Click(Sender: TObject);
begin
  Edit1.Hint := 'Name|Enter full name';
  Edit1.Text := GetShortHint(Edit1.Hint);
end;

Uses