I see... The trick was to define TMyClass!
Thanks!
On 2/1/24 02:19, Michael Van Canneyt via fpc-pascal wrote:
On Wed, 31 Jan 2024, Amir--- via fpc-pascal wrote:
Without more info (declaration of ChildTClass, declaration of the
constructor
of that class etc), it is not possible to commen
On Wed, 31 Jan 2024, Amir--- via fpc-pascal wrote:
Without more info (declaration of ChildTClass, declaration of the
constructor
of that class etc), it is not possible to comment.
We need a complete compilable code sample to provide you with more insight.
Please have a look at the attach
Without more info (declaration of ChildTClass, declaration of the
constructor
of that class etc), it is not possible to comment.
We need a complete compilable code sample to provide you with more
insight.
Please have a look at the attachment.
Best,
Amir
FieldAddress.lpr.gz
Description: a
On Mon, 29 Jan 2024, Amir--- via fpc-pascal wrote:
I am still struggling with this!
for i := 0 to vft^.Count - 1 do
begin
vfe := vft^.Field[i];
Name := vfe^.Name;
ChildTClass := vft^.ClassTab^.ClassRef[vfe^.TypeIndex - 1]^;
ChildObj := ChildTClass.Create;
T
I am still struggling with this!
for i := 0 to vft^.Count - 1 do
begin
vfe := vft^.Field[i];
Name := vfe^.Name;
ChildTClass := vft^.ClassTab^.ClassRef[vfe^.TypeIndex - 1]^;
ChildObj := ChildTClass.Create;
TObject(Obj.FieldAddress(Name)^) := ChildObj;
end;
Look
On 1/22/24 23:05, Michael Van Canneyt via fpc-pascal wrote:
On Mon, 22 Jan 2024, Amir--- via fpc-pascal wrote:
Params := TParams.Create;
WriteLn(Params.Int2.IntVal);
WriteLn(TInteger(Params.FieldAddress('Int2')).IntVal);
The third line does not work (the zipped code is attached).
I
On Mon, 22 Jan 2024, Amir--- via fpc-pascal wrote:
Params := TParams.Create;
WriteLn(Params.Int2.IntVal);
WriteLn(TInteger(Params.FieldAddress('Int2')).IntVal);
The third line does not work (the zipped code is attached).
It should be
WriteLn(TInteger(Params.FieldAddress('Int2')^).Int
Params := TParams.Create;
WriteLn(Params.Int2.IntVal);
WriteLn(TInteger(Params.FieldAddress('Int2')).IntVal);
The third line does not work (the zipped code is attached).
On 1/21/24 23:43, Michael Van Canneyt via fpc-pascal wrote:
On Sun, 21 Jan 2024, Amir--- via fpc-pascal wrote:
How
On Sun, 21 Jan 2024, Amir--- via fpc-pascal wrote:
How can I set the value?
I tried something like
Test := TTest.Create
Ptr := Pointer(Test);
TSub(Ptr+8) := TSub.Create;
But it is not working?
Depending on your platform, it can be an alignment issue.
Use
function TObject.FieldAddress(c
How can I set the value?
I tried something like
Test := TTest.Create
Ptr := Pointer(Test);
TSub(Ptr+8) := TSub.Create;
But it is not working?
You can use the PVmtFieldTable and PVmtFieldEntry types from the
TypInfo unit:
=== code begin ===
program tfield;
{$mode objfpc}{$H+}
uses
TypInf
Thank you!On Dec 27, 2023 7:46 AM, Sven Barth via fpc-pascal wrote:
Am 26.12.2023 um 21:29 schrieb Amir---
via fpc-pascal:
On 12/26/23 01:14, Sven Barth via
fpc-pascal wrote:
Am 26.12.2023 um 21:29 schrieb Amir--- via fpc-pascal:
On 12/26/23 01:14, Sven Barth via fpc-pascal wrote:
Amir--- via fpc-pascal schrieb am
Di., 26. Dez. 2023, 07:03:
Hi,
I want to retrieve the name of the fields in a record/class,
at run
time. It looks like "TVmt.vField
On 12/26/23 01:14, Sven Barth via fpc-pascal wrote:
Amir--- via fpc-pascal schrieb am
Di., 26. Dez. 2023, 07:03:
Hi,
I want to retrieve the name of the fields in a record/class, at
run
time. It looks like "TVmt.vFieldTable" is what I need. But I
cannot find
any doc
Amir--- via fpc-pascal schrieb am Di.,
26. Dez. 2023, 07:03:
> Hi,
>
>I want to retrieve the name of the fields in a record/class, at run
> time. It looks like "TVmt.vFieldTable" is what I need. But I cannot find
> any documentation about how to explore the content of this table. I
> apprecia
Hi,
I want to retrieve the name of the fields in a record/class, at run
time. It looks like "TVmt.vFieldTable" is what I need. But I cannot find
any documentation about how to explore the content of this table. I
appreciate any pointer.
Thank you,
Amir
_
15 matches
Mail list logo