Well I'll be... I had never noticed there was no "Mouse Move?" event
for the picture control. The explanation I had given was meant to be a
generic response, so I was just assumed there was a "Mouse Move?"
event. Just goes to show you: always check first before crossing the
Ben, I'm not sure that he really needs to go down that road given the
level of complexity of that route. What he has will work with just a
few tweaks. He should certainly consider the method given in the nugget as
a future "enhancement" and for his own education.
I made a few tweaks to your VI to get you closer to your goal:
- You can access the "Mouse" property of the picture control
and it provides the coordinates you need. This eliminates the need of the "Convert" VI.
- Labeled the constants on the cluster and used bundle/unbundle by name.
- Added case for accumulating the mouse move events by using shift register as I mentioned.
- Added the "Move Pen" in the Mouse Down event so drawing starts at that point. This means you shouldn't need the "Move Pen" in the "Mouse Move" event.
- Couldn't figure out what you were doing with the initial zoom calculation, so I just hard-wired a value of 1. You'll need to look at this.
Take a look to see if this is closer to what you were trying to do.
As for your comment regarding the button mechanical action: there's nothing inherently "unreliable" about the other mechanical
actions. They do serve a purpose. However, if you notice that when you
plop down one of those rectangular buttons, the mechanical action is
defaulted to "Latch When Released". That's because you want the button
to behave so that the user can click the mouse and hold it down over
the button, but the button doesn't register a value change until the
user lets go of the mouse while cursor is over the button. In this case
it's intended to simulate a single-shot. The "Switch Until Released"
means the state changes as soon as you click it, and it stays that way
until you let go. The way you're using it the effect is the same, and
there's nothing inherently "wrong" with it. It's just not the common
way of doing it. If you prefer your method, and it work, then by all
means use it.