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
 Version 7 TIETextLayer Editor Is Active
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

w2m

USA
1990 Posts

Posted - Apr 12 2017 :  12:37:18  Show Profile  Reply
Is there a procedure to determine if a TIETextLayer is active... in edit mode?
In an app I am working on, a layer is deleted by pressing the delete key. But if the TIETextLayer is editing (or is in edit mode) and the Delete key is pressed the layer is deleted instead of deleting a character. A means is needed to determine if the editor is active so that this can be accounted for when pressing the Delete key in edit mode.

Bill Miller
Adirondack Software & Graphics
Email: w2m@hughes.net
EBook: http://www.imageen.com/ebook/
Custom Commercial ImageEn Development

xequte

38179 Posts

Posted - Apr 12 2017 :  22:57:53  Show Profile  Reply
Hi Bill

Please see the latest push to the Git repository. I have added: TImageEnView.LayersEditingLayer.

// When closing, check if user is editing a layer and prompt to save the changes
procedure Tfmain.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  if ImageEnView1.LayersEditingLayer > -1 then
    if MessageDlg( 'Save changes to text?', mtConfirmation, [ mbYes,mbNo ], 0 ) = mrYes then
      ImageEnView1.LayersCancelEditor( True );
end;




Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page

w2m

USA
1990 Posts

Posted - Apr 13 2017 :  09:53:02  Show Profile  Reply
Hi Nigel,

I managed to get the updates from GIT and when deleting a character when editing a text layer and pressing the DEL key the OnKeyDown event is no longer executed. If the text layer is not editing then OnKeyDown executes and the layer is removed. So it looks like you are handling this automatically in the text editing code. As a result if ImageEnView.LayersEditingLayer > -1 then
Exit; is not even needed.
procedure TForm1.ImageEnViewKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
begin
  case Key of
    VK_DELETE:
      begin
        if ImageEnView.LayersEditingLayer > -1 then
          Exit;
        ImageEnView.LayersRemove(ImageEnView.LayersCurrent);
        ImageEnView.LayersDrawTo(ImageEnMView1.IEBitmap);
        ImageEnMView1.UpdateImage(ImageEnMView1.SelectedImage);
        ImageEnMView1.Update;
        ImageEnView.Proc.ClearAllUndo;
        UpdateGUI;
        UpdateLayers;
        UpdateStatusBar;
      end;
  end;
end;

So now with the update I can delete a character without deleting the layer and if the layer is not being edited the selected layer is removed when DEL is pressed. This is perfect now.

Am I correct?

Bill Miller
Adirondack Software & Graphics
Email: w2m@hughes.net
EBook: http://www.imageen.com/ebook/
Custom Commercial ImageEn Development
Go to Top of Page

xequte

38179 Posts

Posted - Apr 14 2017 :  19:31:40  Show Profile  Reply
Hi Bill

I did not make any changes that should cause that, so I expect it is some slight change in the way you are testing it.

The text editor is a control (owned by the TImageEnView), so they KeyDown event should occur within the text editor control, and not within the TImageEnView, i.e. you should not see the TImageEnView.OnKeyDown event when typing into a text layer in edit mode.




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