Hi, I have created some custom controls (TCustomControl) in Delphi that I can move them at runtime but only one by one. How I can select two or more of these controls, at runtime again, and move them around all together with the mouse?
Thank you.
Hi, I have created some custom controls (TCustomControl) in Delphi that I can move them at runtime but only one by one. How I can select two or more of these controls, at runtime again, and move them around all together with the mouse?
Thank you.
If you can't find any simpler way, you can always do it manually. Keep a list of all the selected controls. When the drag operation begins, make another list, this one containing TPoint values indicating how far on both axes each control's Top and Left properties are from the mouse's position. Then, as the user drags the control, continually update the selected controls to keep them at the proper relative positions to the mouse pointer.
How about a commercial solution? The screen shot shows alignment tools, which would suggest that it supports multi-select.
Another comercial solution would be from DevExpress: LayoutControl. It allows for drag and drop, grouping, full rearrange, hiding and adding of components at runtime.
I once used a component named handles, that if I remember correctly wasn't too difficult to update to the later versions of Delphi and supported multi-select.
Hi Pani,
I am about to design something similar.
I hate to reinvent the wheel, because somewhere out there is a wheel design that will work much better than what I create and it will likely be more efficient and include ideas that I will not initially think of.
Where could I get some basic steps on how to do this? I'm guessing I'd start when the MouseDown event fires, then somehow add the mouse coordinates to the active control's Location property.
Could you point me to anything to get me started? There could even be a keyword that I could search on that would help me find my solution quicker.
Regards, ~Joe