Page 1 of 1
GetSelectionRect Live
Posted: Sat Nov 16, 2024 2:25 pm
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
Re: GetSelectionRect Live
Posted: Sun Nov 17, 2024 8:04 am
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.
Re: GetSelectionRect Live
Posted: Sun Nov 17, 2024 12:35 pm
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 (190.3 KiB) Viewed 738 times
- Selection Guide 2.png (180.24 KiB) Viewed 738 times