This is a fairly easy situation to run into.Whether a user event gets sent multiple times has everything to do with how user events are generated in your application.
If you are using the Action Editor
send user event action and the target object is inside a group, then the event may be triggered multiple times.
If you are using
pgTBObjSet() to send user events, then you will have a lot more control over what happens and which objects are specifically targeted. We have extensively tested
pgTBObjSet() against the scenario of multiple event firing and making sure only targeted objects receive the events. If several remote objects are firing user events using
pgTBObjSet(), then make sure to set
preventMultiDelay =
true. This will force all previous events on the targeted object to be terminated and yield processing
only for the most recent event. However, for
preventMultiDelay =
true to have any effect, you will have to set the
delay parameter to a value greater than zero. Otherwise, there will no queued delays to terminate.
Not knowing how you are generating the events makes this a difficult situation troubleshoot. However, what is stated above may help you to determnine how the events are bubbling in your application. By default,
pgTBObjSet() permits multiple event firing unless
preventMultiDelay is set to
true.
Of course there are other ways to generate multiple user events. For example, action code that is not thought-through fully could inadvertently be doing this as well. You can debug the source of each user event by setting the
value parameter to some value that identifies its source. That way you can identify which object is guilty of multiple triggers or whether code on several objects is exhibiting the same behavior.
Debug recommendation:
If you are using pgTBObjSet() to send the user event, then set myValue to the name of the object sending the event. You can do something similar with the Actions Editor send user event action by setting the value to send to the name of the object sending the event. Then use a simple prompt action on the object receiving the event to check the contents of the value parameter each time the user event fires. This will reveal the object sending the event and will help in diagnosing the problem.
My guess is that you will find that the Actions Editor send user event action is generating the multiple events. Later ToolBook versions improved on this somewhat, but they still demonstrated the multiple event issue—that is, unless the receiving object filtered the event via the value parameter. In the majority of cases, the problem is solved by using PowerPac's pgTBObjSet() to manage events.