Re: [@dxli and @sand1024] please a tip for the RS_Eventhandler
Posted by sand1024 on Apr 10, 2025; 6:36pm
URL: https://forum.librecad.org/fixed-thanks-please-a-tip-for-the-RS-Eventhandler-tp5726883p5726887.html
oh, now I see that you call finish(false); in trigger() method.
I"ll try to make some assumptions and guess - but in general - I don't think that the current implementation is correct way from the overall actions' lifecycle.
If the action is not a one-shoot one that should be finished right after the invocation - instead of calling the trigger() in init(), you need to define the set of states for the action and maintain the state via setStatus() method.
It might be that only one state is supported by the action, that's also ok.
Later, in event handlers (like onMouseMove etc.) - you'll do necessary processing according to the current state of the action.
By default - if you'd like to finish the action, you can call setStatus(-1) (any negative value for the state, actually). Usually right button click returns the action to the previous state until it finish.