I am looking at replacing an old custom form designer with Delphi's form designer. Our application used a custom program for generating forms that could be used our own report writer. It is difficult to maintain the old application and using Delphi for the form designer seems to be a good option. The application that uses this forms is also written in Delphi, but these forms will not actually be displayed as real forms, we will just iterate through the components and generate our report.
One of the features of the current form designer is a "neighbors list". The neighbors list keeps track of the next top, bottom, right, and left cell for every cell on the form. The old designer updates this list when the form is saved during the design phase.
Everything else I need to keep track of maps very easily to your typical control properties (position, height, width, etc.). I can't figure out how to generate and save this type of neighbor information in the dfm.
Is there any way for a component on a form, at design time, to get an event fired when anything on the form changes? Or an event when the form is saved?
I have thought about two approaches to the problem 1) Keep the neighbor information in each individual control. That will kind of work, but still has the problem of getting out of sync when other controls on the form are moved unless I can get an event that let's me know when to update.
2) Have a non-visual component that just keeps track of the list. I could add a custom property editor page that has and "update" button on it that would regenerate the list, but then I would need to remember to click that before the final version was saved. I can see that step being missed and would rather have something that just works.
I could also change the application to dynamically find the neighbors at runtime, but I was hoping I could find a way to make it work at design time.
A solution for any version of Delphi would work.
Any comments as to why this is a bad idea in general will also be appreciated as I have not convinced myself 100% that this is the right approach. :-)