GetSelectionRect Live

General TRichView support forum. Please post your questions here
Post Reply
standay
Posts: 274
Joined: Fri Jun 18, 2021 3:07 pm

GetSelectionRect Live

Post by standay »

Sergey,

Is there a way to get the selection rectangle as it's being drawn when I'm resizing an image? I tried GetSelectionRect and that gives me the correct rectangle but only after I let go of the mouse button. I want the size of the new selection I'm making with the mouse.

Thanks

Stan
Sergey Tkachenko
Site Admin
Posts: 17602
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: GetSelectionRect Live

Post by Sergey Tkachenko »

Sorry. the event where you can get these coordinates is not available.
Adding it may be not so simple, because this rectangle is implemented differently: as drawing on canvas in VCL and Lazarus for Windows, or as a special component in FireMonkey (and, probably, it will be implemented in a third way for Lazarus for Linux).

Why do you need this rectangle? Maybe I can suggest an alternative solution.
standay
Posts: 274
Joined: Fri Jun 18, 2021 3:07 pm

Re: GetSelectionRect Live

Post by standay »

What I'm wanting to do is to match the edges of a selected image to the edge of another. A guide line would help do that. I was thinking of adding one when an image is selected and resized. I actually got that working (see below). An optional way to do it might be to add guide lines (maybe "pulled" from rulers?) but would be more complex to do. Another way would be if it was possible to select non-contiguous items (i.e. multiple images anywhere in the doc) as needed, then use a popup menu to allow matching selected image widths, heights or both to the first image selected.

Here's what I have now. The code is relatively simple and it works although it does need some additional work to check if I'm resizing horizontally or vertically and to just show the appropriate guide.

Selection Guide.png
Selection Guide.png (190.3 KiB) Viewed 4172 times
Selection Guide 2.png
Selection Guide 2.png (180.24 KiB) Viewed 4172 times
Post Reply