Jump to content
Silver Black

Quick and clean way to create auto-snapping forms

Recommended Posts

Is there a quick and clean way to creatro auto-snapping forms (that stick to each others) without using subclassing? I've found a way but only with subclassing and I'd like to know if new Rio 10.3 VLC could allow something like that and not to screen borders only.

Share this post


Link to post

What is build into the VCL is the drag and dock support also used by the RAD Studio IDE, the "snap to border" functionality is something different. If none of these two features match your need you have to build you own, which you seem to have done now.

 

Do you know you can use inheritance with forms as well? Build a base form class with the functionality you need, add it to any new project you need this functionality in and then create new forms in the designer by using File -> New -> Others, and pick the base class from the "inheritable items" section. Just changing the ancestor class from TFrom to your base class in the editor does not work directly, since forms have associated DFM files. You would also need to edit the DFM file as text and change the first "object" to "inherited" for this to work.

Share this post


Link to post
38 minutes ago, PeterBelow said:

What is build into the VCL is the drag and dock support also used by the RAD Studio IDE

Unfortunately not. It's the very basic (and buggy) docking support that was used in Delphi 7 and earlier. The new one is much better but sadly not part of the standard VCL.

(I filed a bug report on that already.)

Edited by dummzeuch

Share this post


Link to post
10 hours ago, PeterBelow said:

What is build into the VCL is the drag and dock support also used by the RAD Studio IDE, the "snap to border" functionality is something different. If none of these two features match your need you have to build you own, which you seem to have done now.

 

Do you know you can use inheritance with forms as well? Build a base form class with the functionality you need, add it to any new project you need this functionality in and then create new forms in the designer by using File -> New -> Others, and pick the base class from the "inheritable items" section. Just changing the ancestor class from TFrom to your base class in the editor does not work directly, since forms have associated DFM files. You would also need to edit the DFM file as text and change the first "object" to "inherited" for this to work.

Thanks,, but I didn't ask about how to inherit a form functionality to a new form, but HOW to implement that functionality!

For now I can do that with subclassing, I just wondered if there is a more hi-level method.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×