Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2009-11

Datamodule and forms data aware components problem

4 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

ik

Hello,

I'm using Lazarus 0.9.29 r22691M FPC 2.5.1 x86_64-linux-gtk 2 (beta). When I create a form and place in the uses section of the interface the data module, some forms with data aware components can find the datasource, while other forms with data aware components can not find the Datasources.

For example:

unit unit1;
interface
Classes , SysUtils , db , sqldb , XMLCfg , FileUtil ,
  LResources , Forms , Controls , Graphics , Dialogs , DbCtrls , ExtCtrls ,
  ComCtrls , StdCtrls , Buttons, dmDatabases;
type
  TForm1 = class(TForm)
 ...
end;
...
end.
unit unit2;
interface
Classes , SysUtils , db , sqldb , XMLCfg , FileUtil ,
  LResources , Forms , Controls , Graphics , Dialogs , DbCtrls , ExtCtrls ,
  ComCtrls , StdCtrls , Buttons, dmDatabases;
type
  TForm2 = class(TForm)
 ...
end;
...
end.

The first form will find the datasource components on dmDatabases unit, while the second form will not.

What am I missing here ?

Thanks,
Ido
http://ik.homelinux.org/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20091120/7aebacba/attachment.html>

Reply by email

Mattias Gärtner
to ik

Zitat von ik :

Show quoted text 41 lines
Hello, I'm using Lazarus 0.9.29 r22691M FPC 2.5.1 x86_64-linux-gtk 2 (beta). When I create a form and place in the uses section of the interface the data module, some forms with data aware components can find the datasource, while other forms with data aware components can not find the Datasources. For example: unit unit1; interface Classes , SysUtils , db , sqldb , XMLCfg , FileUtil , LResources , Forms , Controls , Graphics , Dialogs , DbCtrls , ExtCtrls , ComCtrls , StdCtrls , Buttons, dmDatabases; type TForm1 = class(TForm) ... end; ... end. unit unit2; interface Classes , SysUtils , db , sqldb , XMLCfg , FileUtil , LResources , Forms , Controls , Graphics , Dialogs , DbCtrls , ExtCtrls , ComCtrls , StdCtrls , Buttons, dmDatabases; type TForm2 = class(TForm) ... end; ... end. The first form will find the datasource components on dmDatabases unit, while the second form will not. What am I missing here ?

I assume, you have connected the datasource in the IDE designer and not via code.
Then the connection is stored in the lfm file and the uses section has nothing to do with it.
Just make sure, that your program creates the datamodule before the two forms are created (for example Application.CreateForm statements in the lpr).

Mattias

Reply by email

Paul Ishenin
to ik: I'm using Lazarus 0.9.29 r22691M FPC 2.5.1 x86_64-linux-gtk 2 (beta). When I create a…
ik wrote 5 lines
The first form will find the datasource components on dmDatabases unit, while the second form will not. What am I missing here ?

Lazarus has a different behavior comparing to Delphi. It does not search for the available components in the uses section but it search in the forms/datamodules of the project.

Therefore possible your form1 is included into the project but form2 does not.

Best regards,
Paul Ishenin.

Reply by email

ik
to Paul Ishenin

Thanks,

It helped a lot to find the problem, but I do not understand why it happened.

It seems that the form was not belong to the project (even though I added it using New Form. After adding it to the project, it found the DataModule.

Ido

http://ik.homelinux.org/

Paul Ishenin wrote 25 lines
ik wrote: > > The first form will find the datasource components on dmDatabases unit, > while the second form will not. > > What am I missing here ? > Lazarus has a different behavior comparing to Delphi. It does not search for the available components in the uses section but it search in the forms/datamodules of the project. Therefore possible your form1 is included into the project but form2 does not. Best regards, Paul Ishenin. -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20091120/d3b244b3/attachment.html>

Reply by email