Custom Events are a mess

Custom Events are a mess

Anonymous
Not applicable
398 Views
1 Reply
Message 1 of 2

Custom Events are a mess

Anonymous
Not applicable

I'll put together some demo code if I don't completely give up on custom events but here's what I've noticed that's wrong with them so far...

 

1. The simple act of calling app.registerCustomEvent(event_name) results in a runtime error... saying everything is OK?!? I can't work around this with a try-catch because i need the return value of the call so I can't actually use the custom event i just registered...

 

---------------------------
Error
---------------------------
3 : The event has been registered

--------
Traceback (most recent call last):
...
  File "C:/Users/Ens/AppData/Local/Autodesk/webdeploy/production/49d03f9fc343664d5942b9c34209b4f6b73c6c2d/Api/Python/packages\adsk\core.py", line 2298, in registerCustomEvent
    return _core.Application_registerCustomEvent(self, *args)
RuntimeError: 3 : The event has been registered

---------------------------
Ok   
---------------------------

 

2. registering a custom event before adding inputs to a control results in execute being invoked! Why would registering an event EVER result in execute!?!? This is a huge problem for my intended use (which mind you is trying to come up with a hack-around for group "inputs" triggering up to 3 preview calls (2 if the enable checkbox is disabled, 3 with it enabled) when expanding/collapsing when in fact NO previews should be generated).

 

3. This one is silly but (CustomEventArgs) args.firingEvent.name returns "CustomeEvent", I was hoping it would contain my custom event name, not a fixed string defined somewhere - broken (note the typo in the value!) and useless

 

 

Ya, i probably wont get around to making sample code for this - too frustrated with it for now... maybe tomorrow

 

 

0 Likes
399 Views
1 Reply
Reply (1)
Message 2 of 2

Anonymous
Not applicable

Ok, so the sample code doesn't have problems 1 & 2 - it's likely something to do with the order of execution or some other subtlety

0 Likes