TcxCustomEditButton.Hint Property
Specifies a tooltip (hint) for the editor button.
Declaration
property Hint: string read; write;
Property Value
Type | Description |
---|---|
string | The editor button hint string. |
Remarks
To display a tooltip for an embedded button in a standalone editor, you need to set the editor’s ShowHint property to True
and assign hint text to the Hint
property.
Button Hints in In-Place Editors
To display cell hints for in-place editors in container controls, use the corresponding CellHints
behavior setting.
Data Grid
To enable hints for in-place editors in a grid Table View, set its OptionsBehavior.CellHints property to True
.
Tree List
To enable hints for in-place editors in a Tree List control, set its OptionsBehavior.CellHints property to True
.
Vertical Grid
In-place editor hints are initially enabled in a Vertical Grid control. You can set its OptionsBehavior.CellHints property to False
or True
to disable or enable in-place editor hints.
Code Example
The code example below demonstrates OnButtonClick and OnCreate event handlers.
The application form’s OnCreate event handler creates two additional embedded buttons in a TcxButtonEdit control and configures the appearance and behavior of all embedded buttons. The OnButtonClick event handler associates all created buttons with the editor’s functionality.
Note
This example uses a TcxImageList component with three SVG icons as a source of glyphs for the created buttons.
procedure TMyForm.cxButtonEdit1PropertiesButtonClick(Sender: TObject;
AButtonIndex: Integer);
var
AEditor: TcxButtonEdit;
begin
AEditor := Sender as TcxButtonEdit;
if AButtonIndex = 0 then // The first button clears the editor
AEditor.Clear
else if AButtonIndex = 1 then // The second button selects content
AEditor.SelectAll
else if AButtonIndex = 2 then // The third button hides or reveals content
begin
if AEditor.Properties.EchoMode = eemNormal then
AEditor.Properties.EchoMode := eemPassword
else
AEditor.Properties.EchoMode := eemNormal;
end;
end;
procedure TMyForm.FormCreate(Sender: TObject);
var
AProperties: TcxButtonEditProperties;
I: Integer;
begin
cxButtonEdit1.ShowHint := True; // Enables hints for the editor
AProperties := cxButtonEdit1.Properties;
AProperties.BeginUpdate; // Initiates the following batch change
try
AProperties.Images := cxImageList1; // Assigns the source of button glyphs
// Create two additional buttons
AProperties.Buttons.Add;
AProperties.Buttons.Add;
// Specify common button settings
for I := 0 to AProperties.Buttons.Count - 1 do
begin
AProperties.Buttons.Items[I].Kind := bkGlyph; // Changes the button content type to "glyph"
AProperties.Buttons.Items[I].ImageIndex := I; // Specifies image indexes in the source list
AProperties.Buttons.Items[I].HotTrackMode := TcxEditButtonHotTrackMode.Editor;
end;
// Specify unique button settings
AProperties.Buttons.Items[0].Hint := 'Clear';
AProperties.Buttons.Items[1].Hint := 'Select All';
AProperties.Buttons.Items[2].Hint := 'Hide/Reveal';
AProperties.Buttons.Items[2].LeftAlignment := True;
AProperties.Buttons.Items[2].Transparent := True;
finally
AProperties.EndUpdate; // Calls EndUpdate regardless of the batch operation's success
end;
end;
Tooltip Scaling in RAD Studio 10.3 and Earlier IDEs
Tooltips do not scale properly according to the current monitor DPI in projects built with Embarcadero RAD Studio® 10.3 and earlier IDEs due to a tooltip implementation bug in the VCL library.
To work around this bug, you need to place the TcxHintStyleController component on a form.
Default Value
The Hint
property’s default value is an empty string.