Board index » delphi » Can I set the caption on a label in a form but from a Data Module

Can I set the caption on a label in a form but from a Data Module


2003-07-20 03:25:35 AM
delphi216
I There,
I'm Trying to Put a Splash Screen and when open the tables in a Data Module
set for the user a label(in the Splash) giving the name of the table...
does someone know how to do it????
Augusto Campos
 
 

Re:Can I set the caption on a label in a form but from a Data Module

With 2 Forms works but I am trying with a dataModule and a Form!!!!
And i Get the Exception "Access violation at adress 00537147 in module
'test.exe'.Read of address 00000304".
"Jari Kettunen" <XXXX@XXXXX.COM>escreveu na mensagem
Quote
Just include Splash Screen on datamodule use line.

program Project1;

uses
Forms,
Unit1 in 'Unit1.pas' {Form1},
Unit2 in 'Unit2.pas' {Form2};

{$R *.res}

begin
Application.Initialize;
Form1:=TForm1.Create(application);
Form1.Show;
Application.CreateForm(TForm2, Form2);
Form1.Free;
Application.Run;
end.

unit Unit2;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls,
Forms,
Dialogs;

type
TForm2 = class(TForm)
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form2: TForm2;


implementation

uses Unit1;

{$R *.dfm}

procedure TForm2.FormCreate(Sender: TObject);
begin
Form1.Label1.Caption:='Loading form 2';
ShowMessage('ok');
end;

end.



"Augusto Campos" <XXXX@XXXXX.COM>kirjoitti viestiss?
news:XXXX@XXXXX.COM...
>I There,
>I'm Trying to Put a Splash Screen and when open the tables in a Data
Module
>set for the user a label(in the Splash) giving the name of the table...
>does someone know how to do it????
>
>Augusto Campos
>
>


 

Re:Can I set the caption on a label in a form but from a Data Module

My test program work fine (there is no differens between Form and
Datamodule). Look carefully my project file. Splashscreen is implemeted by
using global form1-variable. My gues is that you have own variable for
Splashscreen on project file and you are not using global form variable.
program Project1;
uses
Forms,
Unit1 in 'Unit1.pas' {Form1},
Unit2 in 'Unit2.pas' {Form2},
Unit3 in 'Unit3.pas' {DataModule3: TDataModule};
{$R *.res}
begin
Application.Initialize;
Form1:=TForm1.Create(application);
Form1.Show;
Application.CreateForm(TForm2, Form2);
Application.CreateForm(TDataModule3, DataModule3);
Form1.Free;
Application.Run;
end.
unit Unit3;
interface
uses
SysUtils, Classes;
type
TDataModule3 = class(TDataModule)
procedure DataModuleCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
DataModule3: TDataModule3;
implementation
uses Unit1,Dialogs;
{$R *.dfm}
procedure TDataModule3.DataModuleCreate(Sender: TObject);
begin
Form1.Label1.Caption:='Loading Datamodule';
ShowMessage('ok');
end;
end.
"Augusto Campos" <XXXX@XXXXX.COM>kirjoitti viestiss?
Quote
With 2 Forms works but I am trying with a dataModule and a Form!!!!

And i Get the Exception "Access violation at adress 00537147 in module
'test.exe'.Read of address 00000304".


 

Re:Can I set the caption on a label in a form but from a Data Module

And if i use a MDI???
"Jari Kettunen" <XXXX@XXXXX.COM>escreveu na mensagem
Quote
My test program work fine (there is no differens between Form and
Datamodule). Look carefully my project file. Splashscreen is implemeted by
using global form1-variable. My gues is that you have own variable for
Splashscreen on project file and you are not using global form variable.
program Project1;

uses
Forms,
Unit1 in 'Unit1.pas' {Form1},
Unit2 in 'Unit2.pas' {Form2},
Unit3 in 'Unit3.pas' {DataModule3: TDataModule};

{$R *.res}

begin
Application.Initialize;
Form1:=TForm1.Create(application);
Form1.Show;
Application.CreateForm(TForm2, Form2);
Application.CreateForm(TDataModule3, DataModule3);
Form1.Free;
Application.Run;
end.

unit Unit3;

interface

uses
SysUtils, Classes;

type
TDataModule3 = class(TDataModule)
procedure DataModuleCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
DataModule3: TDataModule3;

implementation

uses Unit1,Dialogs;

{$R *.dfm}

procedure TDataModule3.DataModuleCreate(Sender: TObject);
begin
Form1.Label1.Caption:='Loading Datamodule';
ShowMessage('ok');
end;

end.

"Augusto Campos" <XXXX@XXXXX.COM>kirjoitti viestiss?
news:3f1aaf97$XXXX@XXXXX.COM...
>With 2 Forms works but I am trying with a dataModule and a Form!!!!
>
>And i Get the Exception "Access violation at adress 00537147 in module
>'test.exe'.Read of address 00000304".
>
>