Alex Rivera | Logout

In Delphi is there a way to see all references and links to a component?

Asked 2011-12-20T17:33:19.540
9

I'm refactoring a large project and have the need to move some components to new modules and forms. Is there a sane way to make sure properties of dependent components are updated?

Maybe grep the project's dfms?

Example: Moving a TDataSource from a huge DataModule to a smaller one. In some cases the source could have been references by 40-50 forms. I need to make sure all controls that reference the data source get updated.

Edit
Report

2 Answers

6

The GREP in GEXperts allows to search both pas and dfm files.

answered 2011-12-20T23:26:18.857
5

First, I sure hope you're using version control.

I realize this is a "so obvious" answer, but the best way I've found to see all references and links to a component is (using version control so I can revert all changes later), rename the property or component, and then see what breaks.

Pascal Analyzer is not much help here.

The Refactoring features of Delphi might be helpful (try a rename refactoring, and see how many places it can suggest that it would automatically rename for you). Do not apply the change, simply review the suggestions.

As far as "moving rather than renaming" some control or resource, ask "why" you are doing it. Why move the datasource? A datasource is simply a landing point for your data aware controls, and you are allowed to have more than one datasource pointing to a single dataset. Why not move only the datasets, and leave the datasources where they are?

answered 2011-12-20T20:19:18.283

Your Answer