Why multiple calls when using RunMacro("xxx","xxx")+DependsOn(BegTrigger)

Started by DJHarris71, September 20, 2021, 05:16:09 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

DJHarris71

Hello,
I am trying to trigger a sub that only triggers when the BegTrigger becomes glued or unglued.
Unfortunately it triggers multiple times.

I have created this user cell: RunMacro("xxx","xxx")+DependsOn(BegTrigger).
I then debug.print a message.  The debugger prints the message twice - indicating it triggered twice.
Even more peculiar is that the sub is called when the Endpoint is moved (not the begin point).

How can I get this sub to trigger once, and only when the begin point is glued or unglued?

Thanks.

Surrogate

Quote from: DJHarris71 on September 20, 2021, 05:16:09 PM
I have created this user cell: RunMacro("xxx","xxx")+DependsOn(BegTrigger).
BegTrigger is depended for EventXFMod.
EventXFMod can triggered few times because changed X and Y coordinates, Lenght and so on.
EventXFMod Cell (Events Section)

DJHarris71

Any thoughts on this question?

"How can I get this sub to trigger once, and only when the begin point is glued or unglued?"



Surrogate

Quote from: DJHarris71 on September 21, 2021, 12:15:28 PM
Any thoughts on this question?
About month ago at Russian Visio forum we have question about EventXFMod.
You can look this discussion via Google Translate service
There is solution for EventXFMod. It works, but I didn't test it for BegTrigger.

Surrogate


DJHarris71

Thanks for the Event Example.
I did this at first, but, by putting here, doesn't it fire for everything tied to the EventXFMod?  I only want it on BegTrigger?
Seems if I make it a User cell as I did (depending on BegTrigger Only), then I limit the amount of times this get fired.  Right?

Even with this, Occasionally I ran into infinite loops.  So to prevent this, I added a 'Global EventTime as Date' variable,
Then in my Sub that I call I added these two lines.  This seems to correct both issues: the multiple triggering and the infinite loop.
Although, this seems like a hack, it seems to do the trick.

If DateDiff("s", EventTime, Now) < 1 Then Exit Sub
EventTime = Now

Thanks for your feedback.  I am smarter now.

Surrogate

Quote from: DJHarris71 on September 21, 2021, 03:30:37 PM
I only want it on BegTrigger?
Seems if I make it a User cell as I did (depending on BegTrigger Only), then I limit the amount of times this get fired.  Right?
I modify my code for is started from User-defined cell. First time i also get infinite loop. But now it works. Try next edition in attachment