mjcho
asked on
Form parameter
I want to avoid a duplicated program.
So, I neet to make a funtion or procedure.
In the next exsample, only formname is different on several cases..
How do I make a procedure?
I think that I have to pass a Form name to function...
ex) ========================== ========== ==
var
FormGF1A2200 : TFormGF1A2200;
FormGF1A3300 : TFormGF1A3300;
recCnt : Integer;
layer : String;
begin
if layer = 'GF1A2200' Then
begin
FormGF1A2200 := TFormGF1A2200.CreateSelf);
recCnt := FormGF1A2200.fnOpen_Query( sSelObjId) ;
If (recCnt> 1) then
FormGF1A2200.Close
else
FormGF1A2200.ShowModal;
end
else if layer = 'GF1A3300' Then
begin
FormGF1A3300 := TFormGF1A3300.CreateSelf);
recCnt := FormGF1A3300.fnOpen_Query( sSelObjId) ;
If (recCnt> 1) then
FormGF1A3300.Close
else
FormGF1A3300.ShowModal;
end;
========================== ========== ===
So, I neet to make a funtion or procedure.
In the next exsample, only formname is different on several cases..
How do I make a procedure?
I think that I have to pass a Form name to function...
ex) ==========================
var
FormGF1A2200 : TFormGF1A2200;
FormGF1A3300 : TFormGF1A3300;
recCnt : Integer;
layer : String;
begin
if layer = 'GF1A2200' Then
begin
FormGF1A2200 := TFormGF1A2200.CreateSelf);
recCnt := FormGF1A2200.fnOpen_Query(
If (recCnt> 1) then
FormGF1A2200.Close
else
FormGF1A2200.ShowModal;
end
else if layer = 'GF1A3300' Then
begin
FormGF1A3300 := TFormGF1A3300.CreateSelf);
recCnt := FormGF1A3300.fnOpen_Query(
If (recCnt> 1) then
FormGF1A3300.Close
else
FormGF1A3300.ShowModal;
end;
==========================
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
procedure YourProc(Sender: TYourForm);
begin
TYourForm(Sender).Color:=.
TYourForm(Sender).Show:=..
Motaz