Board index » delphi » HELP need on DataModules and MDI

HELP need on DataModules and MDI

Hi,
Can someone tell me how can I using MDI forms w/ Data Modules ?

Because same multiple forms always end up point to the same record. It is
not acceptable if the user try to edit multiple record. Is there any
solution or suggestion ?

Thanks in advance
-Tommy <8-)

 

Re:HELP need on DataModules and MDI


Tommy S. Fung <Tommy_F...@MSN.COM> wrote in article
<01bbdcba$13bcf900$6564c8c0@tommy>...

Quote
> Hi,
> Can someone tell me how can I using MDI forms w/ Data Modules ?

> Because same multiple forms always end up point to the same record. It is
> not acceptable if the user try to edit multiple record. Is there any
> solution or suggestion ?

> Thanks in advance
> -Tommy <8-)

This is a common problem of database dev in Windows environ. The options
are :
1. Limit only one form at a time. Easiest but less friendly method.
2. Establish a different session for each form created using Tsession.
Disadvantage is that it involve a lot more coding.

Eugene.

Re:HELP need on DataModules and MDI


Quote
In article <01bbdcf7$211cf7c0$e98110ac@ewong>, "Eugene" <ew...@sembcorp.com.sg> wrote:
>Tommy S. Fung <Tommy_F...@MSN.COM> wrote in article
><01bbdcba$13bcf900$6564c8c0@tommy>...
>> Hi,
>> Can someone tell me how can I using MDI forms w/ Data Modules ?

>> Because same multiple forms always end up point to the same record. It is
>> not acceptable if the user try to edit multiple record. Is there any
>> solution or suggestion ?

>> Thanks in advance
>> -Tommy <8-)

>This is a common problem of database dev in Windows environ. The options
>are :
>1. Limit only one form at a time. Easiest but less friendly method.

Why ?.

If you are creating instances of datamodules at runtime (during the creation
of a form) every DM will have it's own db Pointers. No problem at all.

R.E. den Braasem (aka The Graphical Gnome)
(r...@ktibv.nl)

Senior Software Engineer

Re:HELP need on DataModules and MDI


When we raised this issue many months ago with Borland support we were
told Microsoft no longer supports MDI. I believe that point of view to
be completely false. On the other hand, this is a very difficult area
of Delphi; anyone could be surprised on any given issue. I would like
to be surprised on this one with a good solution, for example.

What I think is true is that D2 support for global references ("name
dot name" as in "MyDataModule.MyTTableComponent") in the IDE is
limited to SDI and those MDI situations where the global reference is
*always* to the *same* TForm or TDataModule. For example, it is OK to
have a TDataSource in a TDataModule that is referenced by different
TMdiChild form instances at run time, as long as it makes sense that
they all need to use the same TDataSource (say, for a linked index or
for a reference table that all make use of for simple lookups).

Otherwise, the properties that reference other TForms or TDataModules
have to be set at Run Time. Remember, in D1 you have to set *all* of
the global references at run time; D2 is an improvement.

There seem to be several difficulties with global references in a MDI
setting. One is that Delphi does global name resolution immediately
after a TForm or TDataModule is created and has had its properties set
and local names resolved. It does this by a look up of the global name
to see if it has already been given an object address. This seems to
be why when a second TMDIChild form is created, any global name in a
property that refers to an already created TDataModule will get
resolved to this first TDataModule.

Another difficulty seems to be that Delphi needs the names in order to
be able to understand exactly *which* TDataModule to refer to. Since
it cannot have two TDataModules with the same non-null name, it will
create a new TDataModule name (suffixing a digit) when the second
TMDIChild form creates a second instance of the TDataModule for
itself; unfortunately, the reference in the TMDIChild will still be to
the old name. We tried many ways around this; all had some problem.
What we need is a workaround that Borland says it wants us to go in.

Leo

On Wed, 27 Nov 1996 15:10:26 -0800, "Tommy S. Fung"

Quote
<Tommy_F...@MSN.COM> wrote:
>Hi,
>Can someone tell me how can I using MDI forms w/ Data Modules ?

>Because same multiple forms always end up point to the same record. It is
>not acceptable if the user try to edit multiple record. Is there any
>solution or suggestion ?

>Thanks in advance
>-Tommy <8-)

Other Threads