TheGrak
11-29-2010, 12:37 AM
I have a script that accepts user input via pickpoint:
-When the user LMB clicks, the fn saves where the user clicked, then calls itself.
-When the user RMB click, the fn calls another fn.
-When the user presses ESC, the fn cancels.
This is all working just fine. The exception is that if the user begins the script, and is in the middle of LMB clicking, but then decides that they want to select the move tool (or any other common task) without first pressing RMB or ESC, the fn breaks. So, I'm referring to that process described as the 'function losing focus'. (Only that fn in the script breaks, other fns work fine.)
When the function loses focus, I think that the fn is still running, awaiting user input in the form of a LMB, RMB, or key press, but for some reason the fn isn't accepting them. I tried to conceptually beat this problem by adding in a default to the case statement described below, but it didn't work.
p = pickpoint()
case of
(
(p == undefined): ...
(p == #escape): ...
(p == #rightClick): ...
(classOf p == Point3): ...
default: ...
)
Questions:
1. What exactly is going on? My guess is probably wrong.
2. Is there a way to 'reset' the fn to a working state? (Besides re-running the script)
3. Can this be handled by a callback/handler/event listener/thingymajig?
4. How would you solve this problem?
-When the user LMB clicks, the fn saves where the user clicked, then calls itself.
-When the user RMB click, the fn calls another fn.
-When the user presses ESC, the fn cancels.
This is all working just fine. The exception is that if the user begins the script, and is in the middle of LMB clicking, but then decides that they want to select the move tool (or any other common task) without first pressing RMB or ESC, the fn breaks. So, I'm referring to that process described as the 'function losing focus'. (Only that fn in the script breaks, other fns work fine.)
When the function loses focus, I think that the fn is still running, awaiting user input in the form of a LMB, RMB, or key press, but for some reason the fn isn't accepting them. I tried to conceptually beat this problem by adding in a default to the case statement described below, but it didn't work.
p = pickpoint()
case of
(
(p == undefined): ...
(p == #escape): ...
(p == #rightClick): ...
(classOf p == Point3): ...
default: ...
)
Questions:
1. What exactly is going on? My guess is probably wrong.
2. Is there a way to 'reset' the fn to a working state? (Besides re-running the script)
3. Can this be handled by a callback/handler/event listener/thingymajig?
4. How would you solve this problem?
