ImageEn, unit iemview

TImageEnMView.OnGetText

TImageEnMView.OnGetText


Declaration

property OnGetText: TIEGetTextEvent;


Description

Occurs before text is output when drawing a thumbnail allowing you to insert or modify the displayed text.

Note:
If Style is iemsColumns then OnGetText is also called for the header row. The Index will be -1.
If default text has not been specified for any thumbnails, you may need to set UpperGap/BottomGap to allow space for the text
You can also use OnGetTextEx to customize text as well as font styling


Examples

// Display the file index above the frame
// Note: In OnFormCreate we set IEFolderMView.UpperGap := 20; or IEFolderMView.DefaultTopText := iedtCustom; to ensure there is spacing for the text
procedure TForm1.IEFolderMViewGetText(Sender: TObject; Index: Integer; Position: TIEMTextPos; var Text: WideString);
begin
  if Index = -1 then
    Text := 'File Number'    // Header row
  else
  if Position = iemtpTop then
    Text := 'File #' + IntToStr(Index + 1);
end;


// Make text no wider than half the thumbnail width
procedure TForm1.ImageEnMViewGetText(Sender: TObject; Index: Integer; Position: TIEMTextPos; var Text: WideString);
begin
  Text := IETruncateStr( Text, iemtsLeft, ImageEnMView1.GetCanvas, ImageEnMView1.ThumbWidth div 2 );
end;