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

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Improved the handling of Text Layers on double-click
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

PeterPanino

933 Posts

Posted - Feb 29 2024 :  06:32:20  Show Profile  Reply
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!

xequte

38608 Posts

Posted - Feb 29 2024 :  14:16:11  Show Profile  Reply
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
Go to Top of Page

PeterPanino

933 Posts

Posted - Mar 01 2024 :  02:39:55  Show Profile  Reply
I see it differently: In my use cases, short texts should be completely replaced:

Go to Top of Page

xequte

38608 Posts

Posted - Mar 02 2024 :  20:28:16  Show Profile  Reply
Hi Peter

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

Nigel
Xequte Software
www.imageen.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: