ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 ObjUserData with IEV_NEXT_INSERTED_OBJECT

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
c.basso 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
3   L A T E S T    R E P L I E S    (Newest First)
xequte 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
c.basso 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
klausdoege Posted - Jun 24 2015 : 04:45:59
Hi,

have you create a new Object ?
with: ImageEnVect.AddNewObject;


Klaus
www.klausdoege.de