Help counting mouse clicks in jit.pwindow to perform different actions
Hello!
I'm trying to draw a line using jit.mgraphics by clicking with my mouse inside jit.pwindow. The problem is that I need to draw different things on the first mouse click (ellipse) and the rest of the clicks (line + ellipse). So, I decided to count the clicks.
Here is my attempt to do this:
It works but the code is _very_ not elegant, so I'm pretty sure I missed a proper way to implement this. Any suggestions?
Thank you!
Not sure it makes it very much more elegant, but here a more minimal version, not using counter
Hello, Vincent! Thanks for help! Unfortunately your example does not work correctly on my system: both messages to jit.mgraphics are fired every mouse click. There is a night around here, I will try to look closer to your code tomorrow.
Here is another one attempt, using your ideas, Vincent: