Search code examples
delphidelphi-xe2firemonkey

Can TSizeGrip be used to move and resize components at runtime (within FireMonkey)?


FireMonkey's predecessor advertised that it could be used to create CAD and GIS programs. I've been exploring FireMonkey and thinking about how to create a simple CAD program. A basic function is to move shapes around on the screen using the mouse. FireMonkey includes a TSizeGrip component, which I suspect may be applicable to moving shapes and providing nodes at corners and edges of a shape for a user to click on. However, the documentation for TSizeGrip hasn't been completed.

Can TSizeGrip be used to allow end-user movement of FireMonkey shapes? If so, how?


Solution

  • No.

    TSizeGrip is provided specifically to act as a "grab handle" for resizing a form, not arbitrary FireMonkey controls or containers.

    You can see this quite easily by creating a new FireMonkey HD application. Drop a TPanel on the form and then drop a TSizeGrip onto that panel.

    Run the application and you will find that when you mouse over and click on the size grip and drag, the form is resized, not the panel. A size grip control would normally be anchored to the lower right of a form.

    If you are wondering why you need a control with such apparently limited use when resizable forms can just be resized using their border, the answer is that it can sometimes be useful to have a form be resizable without having the full draggable border style. e.g. modal dialog boxes.