I create a Text Layer:
procedure TformPreview.DoCreateTextLayer;
begin
// Create a text layer:
ImageEnViewPreview.LayersAdd( ielkText );
TIETextLayer( ImageEnViewPreview.CurrentLayer ).Text := 'Double-click to ' + #13#10 + 'edit the text';
TIETextLayer( ImageEnViewPreview.CurrentLayer ).BorderColor := clBlack;
TIETextLayer( ImageEnViewPreview.CurrentLayer ).BorderWidth := 1;
TIETextLayer( ImageEnViewPreview.CurrentLayer ).SizeToText();
TIETextLayer( ImageEnViewPreview.CurrentLayer ).Alignment := iejCenter;
TIETextLayer( ImageEnViewPreview.CurrentLayer ).Layout := ielCenter;
ImageEnViewPreview.LayersTextRotateMode := iermBoth;
TIETextLayer( ImageEnViewPreview.CurrentLayer ).BorderShape := iesRoundRect;
TIETextLayer( ImageEnViewPreview.CurrentLayer ).Font.Size := 13;
TIETextLayer( ImageEnViewPreview.CurrentLayer ).FillColor := $0080FFFF;
TIETextLayer( ImageEnViewPreview.CurrentLayer ).AutoSize := True;
ImageEnViewPreview.Update();
end;
Now, select all text when I double-click it:
procedure PASendCtrlA;
// Send the keystrokes 'CTRL+A' (select all)
begin
// Press the CTRL key
keybd_event(VK_CONTROL, 0, 0, 0);
// Press the 'A' key
keybd_event(Ord('A'), 0, 0, 0);
// Release the 'A' key
keybd_event(Ord('A'), 0, KEYEVENTF_KEYUP, 0);
// Release the CTRL key
keybd_event(VK_CONTROL, 0, KEYEVENTF_KEYUP, 0);
end;
procedure TformPreview.ImageEnViewPreviewLayerNotify(Sender: TObject; layer: Integer; event: TIELayerEvent);
begin
if event = ielDblClicked then
begin
case ImageEnViewPreview.Layers[layer].Kind of
ielkText:
begin
// Select all text:
PASendCtrlA;
end;
end;
end;
end;
IMO, this should optionally be a standard behavior when double-clicking a text layer!