RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
Controls.GetShortHint Function

Returns the first part of a two-part hint string.

Pascal
function GetShortHint(const Hint: string): string;
C++
AnsiString GetShortHint(const AnsiString Hint);

Call GetShortHint to obtain the short version of the hint specified as the value of a Hint property. The first part of the hint is the text preceding the | character. If the Hint string value is not separated into two parts, GetShortHint returns the entire string.  

C++ Examples: 

 

/*
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 statusbar.
Set the AutoHint property and the SimplePanel property to
True for the statusbar.  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 statusbar.
*/
void __fastcall TForm1::BitBtn1Click(TObject *Sender)
{
  Edit1->Hint = "Name|Enter full name";
  Edit1->Text = GetShortHint(Edit1->Hint);
}

 

Delphi Examples: 

{
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 statusbar.
Set the AutoHint property and the SimplePanel property to
True for the statusbar.  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 statusbar.
}
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
  Edit1.Hint := 'Name|Enter full name';
  Edit1.Text := GetShortHint(Edit1.Hint);
end;

 

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