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
 Request: TImageEnMView.InsertImage and DoSelectionChanged
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

JonMRobertson

USA
32 Posts

Posted - Aug 18 2023 :  08:27:10  Show Profile  Reply
Every method of TImageEnMView.InsertImage calls InsertImageEx(idx, imsAlways). Because InsertImage passes imsAlways for TIEMSelectMode, it always selects the image just inserted. I needed a way to prevent this.

Since InsertImageEx has the SelectMode parameter (which defaults to imsNever), this is a minor change request. I solved this by adding a private field in TIECustomMView and a public property in TImageEnMView, then changed each call to InsertImageEx to use the new property value rather than imsAlways. I set the default value of the new property to imsAlways to maintain current behavior.

The other change that I made was to add a condition where InsertItemEx calls DoSelectionChanged, such that it is only called when SelectMode <> imsNever. I added the same condition in TIECustomMView.DoChanged.

Obviously, there may be a better way to implement this request. And there may be scenarios that I have considered.


Thanks,

Jon

xequte

38611 Posts

Posted - Aug 18 2023 :  22:15:10  Show Profile  Reply
Hi Jon

You can email me for a beta that includes the selection option, iemoDontSelectOnAdd, which does this. Also OnSelectionChange if this is used.

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

JonMRobertson

USA
32 Posts

Posted - Aug 20 2023 :  20:55:22  Show Profile  Reply
procedure TIECustomMView.DoChanged() still calls DoSelectionChanged even when iemoDontSelectOnAdd is set.

Jon
Go to Top of Page

JonMRobertson

USA
32 Posts

Posted - Aug 20 2023 :  22:04:37  Show Profile  Reply
I solved this in my version although I'm not thrilled with my solution.

Jon
Go to Top of Page

xequte

38611 Posts

Posted - Aug 21 2023 :  21:38:36  Show Profile  Reply
Hi Jon

You can email me for a beta update to improve this (there will be still be some instances of SelectionChanged to avoid breakage for legacy users, but that should be rare with iemoDontSelectOnAdd).



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