Jump to content
PenelopeSkye

DFM file is different between version control and Delphi

Recommended Posts

I have been trying forever to find the file with the actual queries being used by the project that I am working with.

 

When I look at the design view of the dfm file I am working with I see all the query objects, and can see the actual queries by selecting the object and clicking on the SQL property, but I wanted to look at the file with all the actual queries, and when I click on the code tab of the dfm file I don't see any queries.

 

But!  When I was updating the app for something completely different when I was looking at our version control software and I saw a query, and the file it was in was the dfm file. 

 

How is it possible that the file in version control has different content than the actual file itself in Delphi (Embarcadero® Delphi 10.3)?

 

I am probably missing something very simple but I can't figure it out myself.

 

Thanks!

 

 

 

 

Share this post


Link to post

Delphi forms and data modules are comprised of two physical files: 1) .PAS, and 2) .DFM.  The .DFM contains all the components and properties set up at design-time in the Delphi IDE; the .PAS file is the "code-behind" or the logic that makes it all work. The queries are stored in the SQL property of query objects, just another text property of a component on the form; thus, they're stored in the .DFM.

 

What you're (likely) seeing in the version control is a difference in the .DFM, not the .PAS file. Your code (.PAS) may not have changed but if a query does, then your .DFM would change.

  • Thanks 1

Share this post


Link to post

You are right!  When I thought I was looking at the code in the dfm file I was actually looking at the code in the pas file.

 

If I want to look at the code in the dfm file I had to bring up the pas file in design mode, right click on the filename and select 'View as Form'. 

 

Rant:

Even when I would bring up the code behind for the dfm file I could not find anything from it using find in files, I had to search the page.

AAAARGH!  How is that useful? 

 

Thanks again David!!! 

Share this post


Link to post
6 hours ago, PenelopeSkye said:

Even when I would bring up the code behind for the dfm file I could not find anything from it using find in files, I had to search the page.

I guess the idea is that since a DFM is a design tool, you can see and access the components directly without needing to search. 

 

Delphi's "Find in Files" only searches the code files (.PAS) and project files (.DPR, .DPK, .DPKW) unless you change the "Where" selection to "Search in Directories." I seldom need to search .DFM files--and then I use an external search tool.

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

×