TcxEditingControl.OnGetScrollbarAnnotationHint Event
Enables you to display hints for scrollbar annotations.
Declaration
property OnGetScrollbarAnnotationHint: TdxGetScrollbarAnnotationHint read; write;
Remarks
This event occurs every time the mouse pointer enters into the area occupied by one or more scrollbar annotation marks. Handle the OnGetScrollbarAnnotationHint event to display a hint for one or more of the triggered annotation marks. For example, the following code example shows a hint for the three custom scrollbar annotations and the predefined error annotation:
procedure TMyForm.cxDBVerticalGrid1GetScrollbarAnnotationHint(Sender: TObject; AAnnotationRowIndexLists: TdxScrollbarAnnotationRowIndexLists; var AHint: string);
function GetValue(ARecordIndex: Integer; AColumn: TcxDBEditorRow): Variant; // Obtains the specified cell value
begin
Result := AColumn.Properties.Values[ARecordIndex];
end;
var
AKind: TdxScrollbarAnnotationKind;
AList: TdxScrollbarAnnotationRowIndexList;
I: Integer;
ACount: Integer;
AAnnotationHint: string;
begin
for AKind in AAnnotationRowIndexLists.Keys do // Iterates through all annotations that require a hint
begin
AList := AAnnotationRowIndexLists[AKind];
ACount := Min(5, AList.Count); // The number of processed scrollbar annotation marks is 5 or the number of triggered marks, whichever is less
for I := 0 to ACount - 1 do // Iterates through all scrollbar annotation marks to be processed
begin
case AKind of
0: // If the mouse pointer enters into the area occupied by a mark of the first custom scrollbar annotation
begin
AAnnotationHint := Format(' %s doors', [IntToStr(GetValue(AList[I], clDoorCount))]);
end;
1: // If the mouse pointer enters into the area occupied by a mark of the second custom scrollbar annotation
begin
AAnnotationHint := Format('(price: %s)', [FormatFloat('$,0;($,0)', GetValue(AList[I], clPrice))]);
end;
2: // If the mouse pointer enters into the area occupied by a mark of the third custom scrollbar annotation
begin
AAnnotationHint := Format(' %s cylinders', [IntToStr(GetValue(AList[I], clCilinderCount))]);
end;
dxErrorScrollbarAnnotationID: // If the mouse pointer enters into the area occupied by a mark of the predefined error scrollbar annotation
begin
AAnnotationHint := ' - MPG City is not specified!';
end;
else // If a scrollbar annotation requires no hint
AAnnotationHint := ''; // Assigns an empty string as a base hint
end;
if AAnnotationHint <> '' then // If the scrollbar annotation mark has a base hint
begin // Expands the base hint with content of the corresponding vertical grid column
AAnnotationHint := Format('%s %s', [GetValue(AList[I], clName), GetValue(AList[I], clModification)]) + AAnnotationHint;
AHint := AHint + IfThen(AHint <> '', dxCRLF) + AAnnotationHint;
end;
end;
if AList.Count > ACount then // If the list of hinted annotation marks is too large
AHint := AHint + dxCRLF + Format('And %d more records...', [AList.Count - ACount]); // Truncates the list
end;
end;
Refer to the TdxGetScrollbarAnnotationHint procedural type description for detailed information on parameters accessible within an OnGetScrollbarAnnotationHint event handler.
See Also