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
 mlMoveLayers and miSelect still incompatible?
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

PeterPanino

933 Posts

Posted - Nov 07 2021 :  05:43:27  Show Profile  Reply
TImageEnView 10.2.0:

MouseInteractGeneral.miSelect and MouseInteractLayers.mlMoveLayers are still MUTUALLY EXCLUSIVE at run-time! (In previous versions they were mutually exclusive even at design-time, i.e. they erased each other at design-time).

This is annoying, as it forces the user to manually switch between modes where he has to explicitly select a mode to EITHER make a selection with the mouse OR to move a selected layer with the mouse.

To make this process of mode-switching somewhat automatic, I have implemented this workaround in my app:

procedure TformMain.imgMainLayerNotify(Sender: TObject; layer: Integer; event: TIELayerEvent);
begin
  if event = ielLeftClicked then
  begin
    if layer = 0 then // user has left-clicked the image-background
    begin
      imgMain.MouseInteractGeneral := [miSelect];
    end
    else  // user has left-clicked a layer
    begin
      imgMain.MouseInteractGeneral := [];
      imgMain.MouseInteractLayers := [mlMoveLayers,mlResizeLayers,mlRotateLayers];
    end;
  end;
end;


But since the LayerNotify event of ielLeftClicked is not instantaneous (it occurs at mouse-button-UP), this is a MULTI-STEP process: The user has to first click either the image-background or a layer, then release the mouse button, and only then he can make a selection or move the layer respectively. It would be better if this mode-switching would occur internally and automatically inside TImageEnView.

What do you think?

xequte

38616 Posts

Posted - Nov 10 2021 :  01:16:11  Show Profile  Reply
Hi Peter

The problem is that the mlMoveLayers and miSelect are mutually exclusive. Clicking the background with mlMoveLayers generates a layer selection rectangle, which clashes with miSelect. Also, mlMoveLayers would prevent miSelect from allowing selection of content within image layers.

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

PeterPanino

933 Posts

Posted - Nov 10 2021 :  03:00:56  Show Profile  Reply
I understand. Could the workaround for automatic switching I proposed above be optimized by TImageEnView internally?
Go to Top of Page

xequte

38616 Posts

Posted - Nov 10 2021 :  04:45:04  Show Profile  Reply
Hi Peter

You would probably be better to implement your code into the MouseDown event. Though there may be side effects.

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

PeterPanino

933 Posts

Posted - Nov 10 2021 :  04:48:03  Show Profile  Reply
Hi Nigel,

But the MouseDown event would not get me the layer number. Why do you think the MouseDown event is better?
Go to Top of Page

xequte

38616 Posts

Posted - Nov 10 2021 :  17:13:36  Show Profile  Reply
You can just use:

lyr := ImageEnView1.FindLayerAt( X, Y );


https://www.imageen.com/help/TImageEnView.FindLayerAt.html

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