The only issue is the construction order of the components that reference datamodules. The data module must be created first in the form/component/frame constructor. Had to put code in to create them in the constructor before the inherited call. Otherwise all works without any other changes. It does mean you have to change the classes unit, and hence live the consequences of changing that unit. But then it only took 1/2 a day or so to rebuild our own complete set of packages.
Very painless. Myles. -----Original Message----- From: Allan, Samuel [mailto:[EMAIL PROTECTED] Sent: Monday, 8 December 2003 14:39 To: NZ Borland Developers Group - Delphi List Subject: RE: [DUG] Form / DataModule Creation Hi Myles, So what did you change? In a more specific sense. Have you found any limitations or issues with what you've changed? Samuel -----Original Message----- From: Myles Penlington [mailto:[EMAIL PROTECTED] Sent: Monday, December 08 2003 2:14 p.m. To: 'NZ Borland Developers Group - Delphi List' Subject: RE: [DUG] Form / DataModule Creation Yes, there are better solutions and I have done them. I regard this issue as a basic Delphi design issue. I had the exact same issue in a Active X control hosted by MS IE. I had to rewrite part of the streaming system to get around the issue. The basic issue is that in Delphi all design time forms are treated by the stream system as Singletons. I made a basic change to how the forms are read back at run time. So things are now linked more closely by scope and ownership rather using singletons. It now defaults back to the basic delphi method of steam/resolving component names if it cannot first find a component of the same name and type on the owning component. Myles. -----Original Message----- From: Allan, Samuel [mailto:[EMAIL PROTECTED] Sent: Monday, 8 December 2003 14:09 To: NZ Borland Developers Group - Delphi List Subject: RE: [DUG] Form / DataModule Creation Hi Craig, I don't know how, but it does succeed in finding the one with the name "SamDataModule", because it's not exactly access violations, but rather incorrect data. I'm thinking that maybe it has a list of Forms / Datamodules by name, and finds them by name? But yeah, I was going to go on setting them at run time unless someone had a better answer. Samuel -----Original Message----- From: Craig Goodall [mailto:[EMAIL PROTECTED] Sent: Monday, December 08 2003 1:46 p.m. To: NZ Borland Developers Group - Delphi List Subject: Re: [DUG] Form / DataModule Creation Hi Allan, The DataSource lives on the form and the datasets in the DataModule. If you create these objects at runtime, you must link the DataSource(s), (and the odd visual component as you mentioned) to the associated dataset at runtime. How else will the form know the address and which datamodule / dataset it's talking to? Regards, Craig. Allan, Samuel wrote: >I have a form / datamodule pair that are created / destroyed together, >and there can be more than one instance of this pair. Visual components >on the form are linked at design time to datasources / datasets on the >datamodule. > >The first pair (named SamForm and SamDataModule) create fine. The >second pair (SamForm_1 and SamDataModule_1) do not. The visual >components on SamForm_1 are all linked to SamDataModule and not >SamDataModule_1, which is what I want. > >I worked around this by re-setting all the links for the visual >components by hand at creation. However, this is not a good solution. >Someone else maintaining my code must know what I am doing and why. If >I add a new DBEdit then I have to remember to add the linking code to >the creation as well, or the DBEdit will look at the wrong data. Simply >moving the DataSource to the form lessens the impact, but does not >eliminate the problem, and some people in my work disagree with doing >this. Also, some visual components, like InfoPower link directly to the >dataset anyway. This must be something that others have experienced. > >Is there a better solution? > >_______________________________________________ >Delphi mailing list >[EMAIL PROTECTED] http://ns3.123.co.nz/mailman/listinfo/delphi > >. > > > _______________________________________________ Delphi mailing list [EMAIL PROTECTED] http://ns3.123.co.nz/mailman/listinfo/delphi _______________________________________________ Delphi mailing list [EMAIL PROTECTED] http://ns3.123.co.nz/mailman/listinfo/delphi _______________________________________________ Delphi mailing list [EMAIL PROTECTED] http://ns3.123.co.nz/mailman/listinfo/delphi _______________________________________________ Delphi mailing list [EMAIL PROTECTED] http://ns3.123.co.nz/mailman/listinfo/delphi _______________________________________________ Delphi mailing list [EMAIL PROTECTED] http://ns3.123.co.nz/mailman/listinfo/delphi
