rpetruni
asked on
how to do this?
Lets say that i have a procedure like this one:
Form1.DBGrid.......somethi ng
and i would like to do this:
aa: some variable;
aa.DBGrid1...., where aa if Form1
and later this:
bb: some variable;
aa.bb... something where aa is form1, and bb is dbgrid1
is it possible and how?
Thanks
Robert
Form1.DBGrid.......somethi
and i would like to do this:
aa: some variable;
aa.DBGrid1...., where aa if Form1
and later this:
bb: some variable;
aa.bb... something where aa is form1, and bb is dbgrid1
is it possible and how?
Thanks
Robert
I can't understand your quesion, what exactly did you want to do ?
why did you want to do this ?
Hi,
YES Just do the follwoing
Type
Form1 = ......
.
.
.
Private
Public
BB: TDBGrid;
end;
var
aa: TForm;
Imp.....
Procedure XYZ........
begin
aa := Form1;
aa.bb.ZZZZZZ :=
end;
YES Just do the follwoing
Type
Form1 = ......
.
.
.
Private
Public
BB: TDBGrid;
end;
var
aa: TForm;
Imp.....
Procedure XYZ........
begin
aa := Form1;
aa.bb.ZZZZZZ :=
end;
more explain !!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
to Motaz and bakry99:
i want to do this:
procedure TOsnovnaForma.Snimi(Ime:St ring; broj:Integer;Sender:TObjec t);
var
i: Integer;
IniZaKolone : TIniFile;
begin
IniZaKolone:=TIniFile.Crea te(RadniDi rektorij + Ime + '.ini');
for i:=0 to broj - 1 do
begin
IniZaKolone.WriteString(Im e, 'Polje: ' + IntToStr(i), SomeForm.DBGrid1.Columns[i ].FieldNam e);
IniZaKolone.WriteString(Im e, 'Naslov: ' + IntToStr(i), SomeForm.DBGrid1.Columns[i ].Title.Ca ption);
IniZaKolone.WriteString(Im e, 'Sirina: ' + IntToStr(i), IntToStr(SomeForm.DBGrid1. Columns[i] .Width));
end;
end;
!!! I want some form, and DBGrid1 to be varible - i want to call this procedure from lots of forms !!!
To cono :
:-)
To cifah:
Your explanation is ok, but only if i try to call this procedure from this form, i need to call it from other forms, and in this situation i don't have acces to components on the form. How to achieve this?
Robert
i want to do this:
procedure TOsnovnaForma.Snimi(Ime:St
var
i: Integer;
IniZaKolone : TIniFile;
begin
IniZaKolone:=TIniFile.Crea
for i:=0 to broj - 1 do
begin
IniZaKolone.WriteString(Im
IniZaKolone.WriteString(Im
IniZaKolone.WriteString(Im
end;
end;
!!! I want some form, and DBGrid1 to be varible - i want to call this procedure from lots of forms !!!
To cono :
:-)
To cifah:
Your explanation is ok, but only if i try to call this procedure from this form, i need to call it from other forms, and in this situation i don't have acces to components on the form. How to achieve this?
Robert
You can write your procedure like this:
procedure TOsnovnaForma.Snimi(Ime:St ring; broj:Integer;Sender:TObjec t;
TheGrid : TDBGrid);
var
i: Integer;
IniZaKolone : TIniFile;
begin
IniZaKolone:=TIniFile.Crea te(RadniDi rektorij + Ime + '.ini');
for i:=0 to broj - 1 do
begin
IniZaKolone.WriteString(Im e, 'Polje: ' + IntToStr(i), TheGrid.Columns[i].FieldNa me);
IniZaKolone.WriteString(Im e, 'Naslov: ' + IntToStr(i), TheGrid.Columns[i].Title.C aption);
IniZaKolone.WriteString(Im e, 'Sirina: ' + IntToStr(i), IntToStr(TheGrid.Columns[i ].Width));
end;
end;
Then just pass the DBGrid from the form when you call the funcTrion.
Cheers,
Raymond.
procedure TOsnovnaForma.Snimi(Ime:St
TheGrid : TDBGrid);
var
i: Integer;
IniZaKolone : TIniFile;
begin
IniZaKolone:=TIniFile.Crea
for i:=0 to broj - 1 do
begin
IniZaKolone.WriteString(Im
IniZaKolone.WriteString(Im
IniZaKolone.WriteString(Im
end;
end;
Then just pass the DBGrid from the form when you call the funcTrion.
Cheers,
Raymond.
ASKER
Thanks rwilson