DocumentEvents OnChange -> Procedure declaration does not match description of event

DocumentEvents OnChange -> Procedure declaration does not match description of event

Bert_Bimmel
Advocate Advocate
478 Views
5 Replies
Message 1 of 6

DocumentEvents OnChange -> Procedure declaration does not match description of event

Bert_Bimmel
Advocate
Advocate

Hello Everybody,

may anyone help me here? I can't find the butter in the fridge: The left code which tries to catch a UIEvent works perfectly fine. The right one refuses to and tells me, my declaration does not match the description etc. blah blah..., although i cannot find any discrepancy to the documentation:

Bert_Bimmel_0-1671113676759.png

 

Cheers, Bert

0 Likes
Accepted solutions (1)
479 Views
5 Replies
Replies (5)
Message 2 of 6

bradeneuropeArthur
Mentor
Mentor
Hey "Bert_Bimmel" how are you doing?
Let me have a look for you!
Regards,
Arthur

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 3 of 6

WCrihfield
Mentor
Mentor
Accepted solution

Hi @Bert_Bimmel.  Just a quick note that may help here.  In pretty much every one of these things, the HandlingCodeEnum type variable should be declared with 'ByRef' instead of 'ByVal'.  The other are usually just fine with 'ByVal'.  That is one snag I ran into several times early on...and the documentation may not indicate this properly, but sometimes you can catch it within the text of the error message...which I think is where I picked it up.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 4 of 6

Bert_Bimmel
Advocate
Advocate

@WCrihfield : That did the trick. Thank you very much. 

 

Maybe this was the key hint I didn't see:

Bert_Bimmel_0-1671206904764.png

But on the other hand, to me that would make sense for all parameters, because i do not hand over any information to the event, do I? I dont't think so: In my understanding all of these parameters are information that the event hands over to me, so I can deal on them.

E.g. the EventTimingEnum: This is some Information that I receive and do not send (i.e. an output). In other words: I do not tell the event "fire before" or "fire after", it fires twice anyway, and i can choose in which of the two cases i want to react when i look at it's acual value.

But if I set that one to ByRef, the whole thing doesn't work again.

I'm happy that it works now, but either I have a basic misunderstandig about event handling, or the whole thing isn't very coherent.

Cheers Bert

0 Likes
Message 5 of 6

WCrihfield
Mentor
Mentor

That last one 'HandlingCode' allows you to change the way the event is handled after you are done with it.  The others are as you said, just information for our convenience.  I didn't realize this my first couple of times either...and sometimes it just doesn't matter, because you may just choose not to deal with it, one way or the other.  It is a good way to prevent certain 'no no's' that you don't want to happen, by checking something about the event, then specifying to abort the action, before it happens.  Other times you are only using the event to gather data, and don't want it to go further than that, so you can set it as handled.  And so on.  Glad I was able to help.  Good luck in your automation plans.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 6 of 6

Bert_Bimmel
Advocate
Advocate

Ok, I think I just have difficulty in changing my role from caller to callee:

Normally, when I call a System function, i provide some arguments, and prepare some neat place where that function can put its result, which I pass as a memory address (i.e. ByRef, or in C-Slang: a Pointer).

Didn't really see, that I am the callee here, and I can pass some result back to the event which calls me.

With that point of view, the whole thing starts making sense to me.

 

Thanks again for this explanation!

 

0 Likes