Trying to read modifing item

Trying to read modifing item

Anonymous
Not applicable
844 Views
6 Replies
Message 1 of 7

Trying to read modifing item

Anonymous
Not applicable

Hi, let's say that I select all the entities in the drawing (CTRL + A). And then move them to new position. I, of course, get objectModified reactor, and now my question starts.

 

I get in objectModified a line. And now, I have to check some data from other entity. But I cannot open the other entity, because I get "eWasOpenedForWrite" error.

 

So, how should I do this properly?

0 Likes
Accepted solutions (1)
845 Views
6 Replies
Replies (6)
Message 2 of 7

wispoxy
Advisor
Advisor
Remove all reactors with (vlr-remove-all)
0 Likes
Message 3 of 7

Anonymous
Not applicable
How should that help? I need those reactors.
0 Likes
Message 4 of 7

wispoxy
Advisor
Advisor
If you want them, never mind then. 😐
0 Likes
Message 5 of 7

dgorsman
Consultant
Consultant

You need to be careful with assumptions during event handling.  Just because one event is being handled, doesn't mean other object are finished being modified.

 

There's a short list of guidelines in the ARX development guide.  In short:

  • Do not rely on the sequence of notification firing
  • Do not rely on the sequence of operations (function calls) between notifications.
  • Do not use any user interaction functions in your notification callback function
----------------------------------
If you are going to fly by the seat of your pants, expect friction burns.
"I don't know" is the beginning of knowledge, not the end.


0 Likes
Message 6 of 7

Anonymous
Not applicable

OK, so how should I do it properly? When an item is under modification (objectModified is fired) I need to know some data from some other item, that can be modified to. So how should I do it properly?

0 Likes
Message 7 of 7

tbrammer
Advisor
Advisor
Accepted solution

Could it be that this other entity (that ist open for write) was opened by yourself?

In that case you should check whether it is required to have it open for write. Maybe you can close it before you modify the other entity.

Or if you have access to the entity-pointer you could also use it directly.

 

Another approach is just to store the ObjectId of the modified object somewhere in your docdata and perform your action later - i.e. in commandEnded() or whatever makes sense to you.


Thomas Brammer ● Software Developer ● imos AGLinkedIn
If an answer solves your problem please [ACCEPT SOLUTION]. Otherwise explain why not.