Would anybody know how to obtain the address of the following control?
Arg1 := @Application.Components[0];This results in "Variable identifier expected" error
Thanks - SteveG

Mailing lists / lazarus / 2010-07
5 messages · 2 people ·
Reply by email Subscribe to this list Your subscription
Read-only archive. Use j and k to move between messages.
Would anybody know how to obtain the address of the following control?
Arg1 := @Application.Components[0];This results in "Variable identifier expected" error
Thanks - SteveG
A class instance is already a pointer.
Arg1 := Application.Components[0] is enough.Best regards,
Paul Ishenin.
Thanks Paul, something new every day :)
I am trying to do the following, but the second assignment type is where I am having problems
NOTE - this is just an example, assuming that app.comp[0] is the one I want (which its not) - otherwise the first assign works ok
Suggestions much appreciated
procedure TForm1.Button1Click(Sender: TObject);
var str1 :string;
begin
str1 := IntToStr( PtrInt( Button1 ) ); // WORKS
str1 := IntToStr( PtrInt( Application.Components[0] ) ); // FAILS
TButton( pointer(StrToIntDef(Trim( str1 ), 0)) ).Caption := 'OK';
end;HOLD THE BUSES :)
I think my example works, but my actual code doesnt I will do some more testing before bothering everyone again Thanks