I would like to store some extra text and numerical data in some GLScene HeightFields, for example datetime stamp, modified by name, a 2D array of Z values, etc. It seems to me that this should be possible using (something equivalent to) a record attached to the .TagObject however I can't work out how I should define the 'record' as an object and then how I can access the data.
Is this a sensible approach? Is there a better way?
How should I define the record/object, create the object & assign it to the HeightField, access the data.
David W
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Take care before close your form, you'll need traverse thë GLScene and free your "TMyRecordClass" objects yourself. Because actually Object and scene haven't got event "OnfreeObject" (it will be a good feature)
So in Form' CloseQuery event or similar you'll must do call a (recursive) freeing function like this, from scratch :
procedure TForm1.FreeTagObject(anObject : TGLBaseSceneObject);
Var
i : Integer;
TmpObject : TGLBaseSceneObject;
begin
if anObject.count>0 then
begin
For i:=0 to anObject.Count-1 do
begin
TmpObject := GLScene1.Objects[i];
if anObject.HasSubChildren then FreeTagObject(TmpObject);
if assigned(TmpObject.TagObject) then
begin
TMyRecordClass(TmpObject.TagObject).Free;
TmpObject.TagObject := nil;
end;
end;
end;
end;
procedure TForm1.FormCloseQuery(Sender : TObject; var CanClose : boolean);
begin
FreeTagObject(GLScene1.Objects);
end;
In hope this could help you
Cheers
Last edit: Jerome.D (BeanzMaster) 2019-06-14
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I would like to store some extra text and numerical data in some GLScene HeightFields, for example datetime stamp, modified by name, a 2D array of Z values, etc. It seems to me that this should be possible using (something equivalent to) a record attached to the .TagObject however I can't work out how I should define the 'record' as an object and then how I can access the data.
David W
Hi Dave the better is instead of record is using a class and assign it to the tagobject. But becareful
Take care before close your form, you'll need traverse thë GLScene and free your "TMyRecordClass" objects yourself. Because actually Object and scene haven't got event "OnfreeObject" (it will be a good feature)
So in Form' CloseQuery event or similar you'll must do call a (recursive) freeing function like this, from scratch :
In hope this could help you
Cheers
Last edit: Jerome.D (BeanzMaster) 2019-06-14
Hi Jerome,
Thank you for the help! I will give it a try...
David.