Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X
Hello everyone, im stuck on a few things trying to implement some action listeners in Creo using visual basic in Microsoft Visual Studio 2013. I will try before posting the complete problem a couple of modifications, but at this time i would like to place an open question.
Can anyone tell me the importance that the highlighted line of code from below has ?
aC.Session.AddActionListener(listenerObj) | |
aC.AddActionListener(Me) |
The code is taken directly from the VB api examples available from Creo. The action listener works without the second line, so im curious about what it actually does.
Any insight is most welcome. Thank you.
Hmmm, i have seen VB examples where they are using "Me" as a reference to the active Form object.
Example: Me.Close
If that is the case then i guess this line would assign an action listener to the active form.
Not sure if that is whats going on here..
Hello Hugo, thanks for engaging in the topic. Although it is clear that it is adding an action listener to the active form, i am not sure of the implication.
I dont know why, in my case, when i use aC.AddActionListener(Me) i get "Type mismatch. ( Exception from HRESULT: 0x80020005 (DISP_E_TYPEMISMATCH))" when i run the application. I cannot find any difference in the way aC is defined in the examples and my own definition of it.
Because of this i just used aC.AddActionListener(objlistener) instead of "Me" ..again, not sure of the implication because the documentation is really lacking in details about the inner workings of the listeners.
So maybe because of this i get the CommError, after which it is necessary to force close Creo and also close the processes associated with it. It is like Creo starts to hang while it receives something back from the application. I dont know how to give "control" back to Creo, and from the VB API examples i cannot say that it does something in this direction, it just runs the action listener routine without explicitly returning control to Creo..