ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Improved the handling of Text Layers on double-click

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
PeterPanino Posted - Feb 29 2024 : 06:32:20
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!
3   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - Mar 02 2024 : 20:28:16
Hi Peter

You should insert some code in your app to handle that special case.

Nigel
Xequte Software
www.imageen.com
PeterPanino Posted - Mar 01 2024 : 02:39:55
I see it differently: In my use cases, short texts should be completely replaced:

xequte Posted - Feb 29 2024 : 14:16:11
Hi

It behaves that way for new text layers, but not when editing existing text layers (because when you are editing existing text, you generally do not want to completely replace it, only change some of it).

Nigel
Xequte Software
www.imageen.com