HI! Thanks in advance.
I wanna make comething like this:

Procedure GETDATA( VAR	 x	: TCaption	)	;
Begin
     ....
	x	:= '1'	;
     ...
End	;


    ...
    ...

        a( SOMEString )     ;
	a( SOMETEDit.Text )	;
	a( SOMETLabel.Caption )	;

end;

HOw can I solve it? Thanks!!!

THnaks pritaeas! but I will get NO ANSWER from function....

Do you call your procedure ? You may need to show some more code, or explain what you want to happen.

HI pritaeas, thanks in advance.

I make some small real code in Delphi

---
procedure P( S : TCaption);
begin
S := '1' ;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
P(Label1.Caption) ;
P(Edit1.Text)
end;

If a write VAR params doesn't compile. If don't returns nthing as pascal define


I don't wanna have a 1 function for every need,l like this


procedure P( Var S : String);
begin
S := '1' ;
end;

procedure P( Var S : TEdit);
begin
S.Text := '1' ;
end;

procedure P( Var S : TLabel);
begin
S.Caption := '1' ;
end;


Thanks!!!!

This should work:

procedure P(var S: string);
begin
  S := '1' ;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  P(Label1.Caption) ;
  P(Edit1.Text)
end;

AS I told you on first date: E2197 Constant object cannot be passed as var paramet

:( its a delphi mistake

D2010

Does this work ?

function P: string;
begin
  Result := '1' ;
end;
 
procedure TForm1.Button1Click(Sender: TObject);
begin
  Label1.Caption := P;
  Edit1.Text := P;
end;
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.