Author |
Topic |
|
PeterPanino
864 Posts |
Posted - Jun 25 2021 : 07:57:49
|
Normally, a selected Layer can be deleted by simply pressing the Delete key.
However, when I create a Layer with this code:
ImageEnView1.Proc.PasteFromClipboard(iecpLayer);
...then the Delete key has no effect on the selected Layer!?
Please note: loKeyboardShortcuts is included in LayerOptions per Default. |
|
xequte
38217 Posts |
Posted - Jun 25 2021 : 16:47:46
|
Hi Peter
Are you sure that the ImageEnView has focus?
Try setting ImageEnView1.SetFocus(); after the paste operation.
Nigel Xequte Software www.imageen.com
|
|
|
PeterPanino
864 Posts |
Posted - Jun 25 2021 : 17:08:56
|
Hi Nigel,
sure the ImageEnView has the focus, as I click on the Layer after it has been created and move it around with the mouse for a while and only then I press the Delete key. This is the code I use:
ImageEnView1.MouseInteractLayers := ImageEnView1.MouseInteractLayers + [mlMoveLayers, mlResizeLayers];
ImageEnView1.Proc.PasteFromClipboard(iecpLayer); |
|
|
PeterPanino
864 Posts |
Posted - Jun 25 2021 : 17:33:30
|
However, this is very strange:
When I REPEAT the very same Paste operation to insert another layer, then I click on the first pasted layer and press the Delete key, then it gets deleted! Then I click on the remaining Layer (which was pasted afterward) and then press the Delete key, also this Layer gets deleted!
So it seems, that as soon I have pasted MORE THAN ONE LAYER, the deleting with the Delete key works!
|
|
|
PeterPanino
864 Posts |
Posted - Jun 25 2021 : 17:41:42
|
And there is another strange issue: After creating the Layer with the above code, the mouse selection on the ImageEnView does not work anymore! (MouseInteractGeneral = [miSelect] per Default) |
|
|
PeterPanino
864 Posts |
Posted - Jun 25 2021 : 18:05:41
|
Why I cannot have:
MouseInteractGeneral = [miSelect] and MouseInteractLayers = [mlMoveLayers,mlResizeLayers]
...at the same time? Making a selection with the mouse on ImageEnView and moving/selecting layers are not mutually exclusive by logic? |
|
|
PeterPanino
864 Posts |
Posted - Jun 25 2021 : 18:54:44
|
I have found a funny solution:
ImageEnView1.Proc.PasteFromClipboard(iecpLayer);
ImageEnView1.CurrentLayer.Selected := False;
After this, I can select the created Layer with a mouse-click and then delete it with the Delete key!
But is there no way to have the layer automatically selected after the Paste operation and then being able to delete it with the Delete key? |
|
|
xequte
38217 Posts |
Posted - Jun 25 2021 : 20:45:27
|
Hi Peter
ImageEn avoids behaviour clashes, which it considers the following to be:
MouseInteractGeneral := [miSelect]; MouseInteractLayers := [mlCreate*Layers,mlMoveLayers,mlResizeLayers];
If mlCreate*Layers is removed, then technically it would be possible, but we don't allow it because we did not consider it a likely combination. I will reconsider that for a later update.
I cannot reproduce your Delete error. Are you able to reproduce it in one of our demos? If so, please give me the steps.
Nigel Xequte Software www.imageen.com
|
|
|
PeterPanino
864 Posts |
Posted - Jun 26 2021 : 04:38:13
|
If mlCreate*Layers is removed, then technically it would be possible, but we don't allow it because we did not consider it a likely combination.
From the USER's perspective, not being able to work with Layers (move/resize them) while simply creating a selection in ImageEnView and vice-versa is counterintuitive and difficult to understand.
Please allow SELECTION-MODE and MOVE/RESIZE-LAYERS-MODE to coexist! For the user, this is a logical pre-condition for a graphics application.
Regarding the Delete-key issue, I will prepare a small demo. |
|
|
PeterPanino
864 Posts |
Posted - Jun 27 2021 : 06:25:24
|
I have created the following demo project which demonstrates how to automatically toggle between LAYER-MOVE/RESIZE-MODE and SELECTION-MODE. It also shows how the created layer cannot be removed with the DELETE key:
attach/PeterPanino/202162761733_DeleteLayerProblem.zip 22.11 KB
(To see the error where the Delete key does not remove the layer, click on the background and then again click on the layer).
This is the code that automatically selects the appropriate mode:
procedure TForm1.imgMainLayerNotify(Sender: TObject; layer: Integer; event: TIELayerEvent);
begin
if event = ielLeftClicked then
begin
if layer <> 0 then
begin
//CodeSite.Send('TForm1.imgMainLayerNotify: clicked on layer');
imgMain.MouseInteractLayers := imgMain.MouseInteractLayers + [mlMovelayers, mlResizeLayers];
imgMain.Layers[layer].Selected := True;
end
else
begin
//CodeSite.Send('TForm1.imgMainLayerNotify: clicked on background');
imgMain.LayersDeselectAll;
if not (miSelect in imgMain.MouseInteractGeneral) then // if SELECTION-MODE has been switched off then...
imgMain.MouseInteractGeneral := imgMain.MouseInteractGeneral + [miSelect]; // ...restore SELECTION-MODE
end;
end;
end;
(However, it would be better if both LAYER-MOVE/RESIZE-MODE and SELECTION-MODE would peacefully co-exist in TImageEnView, so there would be no need to switch between them programmatically)
And this is the visual demonstration of how it is operated:
|
|
|
PeterPanino
864 Posts |
Posted - Jun 27 2021 : 09:25:11
|
Hi Nigel,
I have now created this workaround to overcome the error of the layer not being deleted:
procedure TForm1.imgMainKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
begin
case Key of
VK_DELETE:
begin
if imgMain.LayersSelCount(False) > 0 then
imgMain.LayersRemove();
end;
end;
end;
What do you think? |
|
|
xequte
38217 Posts |
Posted - Jun 28 2021 : 00:48:57
|
Hi Peter
I've tried your demo above as follows: 1. Run 2. Choose an image 3. Make a selection 4. Edit > Copy 5. Edit > Create Image Layer 6. Click background 7. Click layer 8. Click Delete >>> Layer is deleted.
Am I missing a step? What version of ImageEn are you using?
FYI, for 10.0.2 it will be possible to use any combination of the following together:
miSelect, mlMoveLayers, mlResizeLayers, mlRotateLayers
Nigel Xequte Software www.imageen.com
|
|
|
PeterPanino
864 Posts |
Posted - Jun 28 2021 : 03:39:36
|
Hi Nigel,
I assume with "8. Click Delete" you mean "Press the DELETE KEY"?
When repeating the exact 8 steps several times, here RANDOMLY it happens SOMETIMES that the layer gets deleted, but most times it doesn't.
ImageEnVersion property is 10.0.0. Unit imageenview.pas has no specific version information, although I got ImageEn_Source_1002_Beta_527 source from you by email and currently I'm using that.
Is there anywhere exact version information in the source?
I am happy to hear that 10.0.2 RELEASE version with the mentioned feature (using miSelect, mlMoveLayers, mlResizeLayers, mlRotateLayers together) is coming soon. When will that exactly be? |
|
|
xequte
38217 Posts |
Posted - Jun 29 2021 : 18:52:15
|
Hi Peter
V10.0.2 will be ready in about two weeks.
Nigel Xequte Software www.imageen.com
|
|
|
|
Topic |
|