Delphi32.com - Home!
| Home/News | Downloads | Forums | D32 Magazine | Resources | Info and Facts |  
 
 Master/Detail relationships with data-aware controls.


Why are my Master/Detail relationships not showing the correct detail in the data-aware controls when I scroll through the master?   

    This is a known bug in Delphi 5 and will be fixed. It seems to only happen with queries. Using persistent fields will make it worse. Here is a good workaround which was posted on the borland newsgroup. It requires editing and recompiling the file 'dbctrls.pas' which comes with Delphi.

    First find the file 'dbctrls.dcu' on your machine. If you did a default install it should be at 'C:\Program Files\Borland\Delphi5\Source\Vcl'. Rename this to something like 'dbctrls_ORIGINAL.dcu' so you can get it back later if you want. Next start a new, blank application and open the file 'C:\Program Files\Borland\Delphi5\Source\Vcl\dbctrls.pas'. Add Dbctrls to the uses clause of the blank project. Find the definition for procedure TFieldDataLink.UpdateField; and change the code to the following. You may want to just comment out the code that is there in order to save it.

    procedure TFieldDataLink.UpdateField; var TempField : TField; begin if Active and (FFieldName <> '') then begin if Assigned(FControl) then TempField := GetFieldProperty(DataSource.DataSet, FControl, FFieldName) else TempField := DataSource.DataSet.FieldByName(FFieldName); if TempField <> FField then SetField(TempField) else begin FField := NIL; SetField(TempField); end; end else SetField(nil); end;

    Finally, save and Build All Projects (Projects menu). If you get an error that 'dbctrls.dcu' cannot be found then you need to go into Tools|Environment Options|Library and add the path C:\Program Files\Borland\Delphi5\Source\Vcl (or whatever your actual path to the Vcl directory is) to the Library Path.

    Now you should be able to compile and create a new 'dbctrls.dcu' file, and your data-aware controls should be updating.

     



  << Previous Faq     Complete List     Next Faq >>  



 
 Hits/month  2,500,000+ 
 Downloads
 (Since May 2000)
 7,393,709 
 Total Files  6,023 
 Forum msgs  7,670 
 Articles/FAQs  70+/900+ 
Kylix
Tips n Tricks
FAQs
Knowledge Base
Bug Listings
Articles
Books
Newsgroups
Links
Submissions
Testimonials
Advertising
Contact Us
About Us
Search Amazon:
Top Selling Software at Amazon

| Home/News | Downloads | Forums | Resources | Info and Facts | Testimonials |
  Site Search:
 


Comments/Problems: Webmaster@delphi32.com
Copyright © 1998-2006, Delphi32.com. All rights reserved.
Terms of Use