Hi, I have implemented MyData as follows (I have several hundred objects, at any time, do I need to FreeMem(MyData, SizeOf(TMyData)); ?:-
type
TMyData = record
Group: Integer;
Name: String[100]; // Works
Description: String[255]; // Fails
Tag: Boolean;
end;
PMyData = ^TMyData;
...
ihObj:= ievFront.AddNewObject;
ievFront.ObjKind[ihObj]:= iekPOLYLINE;
ievFront.ObjBrushStyle[ihobj]:= bsSolid;
ievFront.ObjBrushColor[ihobj]:= clRed;
ievFront.ObjPenWidth[ihObj]:= 1;
ievFront.ObjPenColor[ihObj]:= clBlack;
ievFront.ObjStyle[ihObj]:= [ievsVisible, ievsSelectable, ievsSizeable];
ievFront.OffScreenPaint:= True;
ievFront.PolylineClosingMode:= iecmAlways;
ievFront.SetObjPolylinePoints(ihObj, MyPointsArray);
ievFront.ObjPolylineClosed[ihObj]:= True;
GetMem(MyData, SizeOf(TMyData));
MyData^.Group:= 0;
MyData^.Name:= IntToStr(ihObj)+#0; // Tried With and Without #0
MyData^.Description:= 'Does Not Work'+#0; // Tried With and Without #0
ievFront.ObjUserData[ihObj]:= MyData;
ievFront.ObjUserDataLength[ihObj]:= SizeOf(TMyData);
// If I free here (FreeMem(MyData, SizeOf(TMyData));) we get errors
...
procedure TfMain.ievFrontObjectOver(Sender: TObject; hobj: Integer);
var
s: String;
begin
StatusBar1.Panels[1].Text:= '';
if hobj = 152 then begin
s:= 'debug';
end;
try
MyFetchData:= ievFront.ObjUserData[hobj];
if MyFetchData <> nil then begin
// Description Always is '' // Tried MyFetchData^.Description too
StatusBar1.Panels[1].Text:= MyFetchData.Description;
end;
except
end;
end;
Andy