In article <4skvqb$...@news.xs4all.nl>,
w...@xs4all.nl (Wilko van der Ploeg) wrote:
Quote
>Because -as I told before- I do like datamodules, 'plastering tables
>on the form' is no solution to me, so please does anyone know how to
>create seperate instances of the datamodule for each MDI form ???
I did some experiments, and was unable to find any way around this
irritating behavior. It is possible to use a datamodule, even if you delete
the global instance variable. It only seems to require that one exist
somewhere -- anywhere -- in the application space. But all the instances
(say of multiple MDI child forms) will only use the first instance. I seem
to remember reading somewhere that they automatically instantiate a
datamodule and binds the data aware components to that instance, creating
one if necessary -- but I couldn't find this in a brief search.
Can someone provide a reference in the VCL to where the datamodules are
automatically bound to their referents?
It may be possible to do a very simple little patch that would allow each
form to get its own datamodule. (For example, if it is looking for the
first match in a list, it might be possible to force a new instance into
the beginning of the list, thus tricking the search.)
Of course you can always declare a form variable of the datamodule's type,
and create an instance, but that doesn't connect the components to that
datamodule instance -- the work-around, which I've also tried, is assigning
all the values (Datasource, etc.) at run time. That is a royal pain in the
butt, and in many cases breaks your forms at design time (so you can't
verify SQL is correct, and similar things), so I wouldn't recommend it. An
intermediate solution, is putting datasources on forms, and datasets on
datamodules.
--
Brad Aisa <ba...@tor.hookup.net> http://www.hookup.net/~baisa/
"The highest responsibility of philosophers is to serve as the
guardians and integrators of human knowledge." -- Ayn Rand