Home
Features
Demos
Store
Forum
Support
ImageEn Forum
Profile
Join
Active Topics
Forum FAQ
Search
Forum membership is Free! Click
Join
to sign-up
Username:
Password:
Save Password
Forgot your Password?
All Forums
ImageEn Library for Delphi, C++ and .Net
ImageEn and IEvolution Support Forum
ObjUserData with IEV_NEXT_INSERTED_OBJECT
New Topic
Reply to Topic
Author
Topic
c.basso
Italy
36 Posts
Posted - Jun 23 2015 : 12:11:19
Hi,
after seeing UserDataVect demo,
I'm trying to put data on my next inserted object,
like this:
>> This is my user data
type
TMyData=record
text1:string[255];
text2:string[255];
end;
PMyData=^TMyData;
>> On my button click event
GetMem(vUserData, SizeOf(tmydata));
vUserData^.text1:= 'hello';
vUserData^.text2:= 'hello';
ctrlImageEnVect.ObjUserData[IEV_NEXT_INSERTED_OBJECT]:= vUserData;
ctrlImageEnVect.ObjUserDataLength[IEV_NEXT_INSERTED_OBJECT]:= SizeOf(TMydata);
ctrlImageEnVect.MouseInteract:= [];
ctrlImageEnVect.MouseInteractVt:= [miPutLine];
ctrlImageEnVect.Cursor:= crIEPencil;
>> On my AfterDrawObject event
var
vUserData: PMyData;
begin
vUserData:= ctrlImageEnVect.ObjUserData[hobj];
if (vUserData <> nil) then
begin
>>> NEVER FIRED, vUserData is always nil
end;
What I'm doing wrong?
Thanks
Claudio
klausdoege
Germany
389 Posts
Posted - Jun 24 2015 : 04:45:59
Hi,
have you create a new Object ?
with: ImageEnVect.AddNewObject;
Klaus
www.klausdoege.de
c.basso
Italy
36 Posts
Posted - Jun 24 2015 : 04:50:49
When I must create the object?
The object is created using mouse, as:
ctrlImageEnVect.MouseInteractVt:= [miPutLine];
I expect that using IEV_NEXT_INSERTED_OBJECT,
after the user creates the line with mouse,
in AfterDrawObject the object must have the userdata.
It's not like this?
Claudio
xequte
38615 Posts
Posted - Jun 24 2015 : 22:27:18
Hi
I'm not sure this is the best way to do it as there is real risk of memory leak. You would be better to set it in the OnNewObject event.
Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Topic
New Topic
Reply to Topic
Jump To:
Select Forum
ImageEn Library for Delphi, C++ and .Net
ImageEn and IEvolution Support Forum
--------------------
Home
Active Topics
Frequently Asked Questions
Member Information
Search Page