Hi Michael,
The changes made in the Sept 10 beta definitely help in that pressing Esc no longer throws an exception.
> Update Esc script cancelling
> Use different method to determine time since last wait for event. The previous method of watching calls to
> WaitableObject::waitForEvent() is not good because there are other kinds of event loops that do not go through
> WaitableObject, like modal dialogs or combo box dropdowns. The new method should handle all types of event loops.
I am seeing something puzzling though: pressing Esc acts differently than clicking on Cancel. I tend to use Esc rather than Cancel and would like Esc to behave the same as Cancel. Admittedly I do not have a good handle on the event structure being used, but I'm attempting to write a script which behaves consistently with the rest of the MoI. I believe this was happening with the last beta, but I was hung up on the exceptions being thrown.
My Coordinates script has two pointpicker loops (or phases of operation): first, picking the leader arrow tips in doCoordinates(), and second, picking the leader points in coordinateLeader(). Although it is two functions, it is in effect a nested loop and makes use of pointpicker.allowNestedCancel() to allow more granular control over removing just the current objects rather than all objects created during the command execution.
If I click on the Cancel button in the inner phase, that phase cleans up and goes back to the outer phase which allows another leader arrow to be picked. If I press Esc instead, the inner phase cleans up, returns to the outer phase, but another cancel event is magically generated causing the command to exit. The following traces illustrate the difference & the Prompt/Action pairs explain how to reproduce the behavior.
Clicking on the Cancel button during the "Pick next leader point" (inner) phase:
code:
/Users/michael/src/moix/moi_lib/Init.cpp 310: Moi starting up
MoI version: 4.0 Beta Sep-10-2020
1ms: doCoordinates()
Prompt: “Coordinates options"
Action: Click Done
Prompt: “Pick leader arrow tip"
Action: Pick point
3444ms: doCoordinates() event: finished
3444ms: coordinateLeader()
Prompt: “Pick next leader point"
Action: Click on Cancel button
6930ms: coordinateLeader() canceled: cancelbutton
6930ms: coordinateLeader() event: cancel
Prompt: “Pick leader arrow tip”
Action: Click on Done button
8433ms: doCoordinates() event: done
Pressing Esc key during the "Pick next leader point" (inner) phase:
code:
/Users/michael/src/moix/moi_lib/Init.cpp 310: Moi starting up
MoI version: 4.0 Beta Sep-10-2020
1ms: doCoordinates()
Prompt: “Coordinates options"
Action: Click Done
Prompt: “Pick leader arrow tip"
Action: Pick point
3194ms: doCoordinates() event: finished
3195ms: coordinateLeader()
Prompt: “Pick next leader point"
Action: Press Esc key
9764ms: coordinateLeader() canceled: escape
9764ms: coordinateLeader() event: cancel
9806ms: doCoordinates() canceled: cancelbutton <<< extra event is being magically generated
9806ms: doCoordinates() event: cancel
Code is attached for reference.
--Larry