Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2010-07

Obtaining Control Address

5 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

SteveG

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

Reply by email

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

A class instance is already a pointer.

Arg1 := Application.Components[0] is enough.

Best regards,
Paul Ishenin.

Reply by email

SteveG
to Paul Ishenin
Paul Ishenin wrote 10 lines
30.07.2010 8:06, SteveG wrote: > Would anybody know how to obtain the address of the following control? > > Arg1 := @Application.Components[0]; > > This results in "Variable identifier expected" error A class instance is already a pointer. Arg1 := Application.Components[0] is enough.

Thanks Paul, something new every day :)

Reply by email

SteveG
to SteveG
SteveG wrote 14 lines
Paul Ishenin wrote: > 30.07.2010 8:06, SteveG wrote: >> Would anybody know how to obtain the address of the following control? >> >> Arg1 := @Application.Components[0]; >> >> This results in "Variable identifier expected" error > > A class instance is already a pointer. > > Arg1 := Application.Components[0] is enough. 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;

Reply by email

SteveG
to SteveG
SteveG wrote 33 lines
SteveG wrote: > Paul Ishenin wrote: >> 30.07.2010 8:06, SteveG wrote: >>> Would anybody know how to obtain the address of the following control? >>> >>> Arg1 := @Application.Components[0]; >>> >>> This results in "Variable identifier expected" error >> >> A class instance is already a pointer. >> >> Arg1 := Application.Components[0] is enough. > > 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

Reply by email