04-07-2015 02:56 AM
04-07-2015 03:44 AM
Without seeing your code (and UI) we cannot really give good guidance. Nevertheless, i see two options:
a) Stick with a dialog VI which is displayed in front ("focus") but can be moved to background (non-modal). This has the issue that the user can "click it away without closing it". That could result in a "hang". But you can use keybinding on that dialog to have ENTER bound to "OK" and ESCAPE bound to "Cancel".
b) Do what you consider to catch these two keys in your event structure and enqueue appropriate elements in your QDMH worker. The only thing i wonder is how you want to guide the user properly through that "how to use"....
Norbert
04-08-2015 12:08 AM
It sounds like you got the idea but heres my code anyways.
Invisible Dialogue is just "Main original" with an invisible dialogue instead of the one that shows up
04-08-2015 02:20 AM
I hope this is functioning as you want it to do.
Nevertheless a couple of feedback points:
1. The notifier is a waste. Remove it. Simply use the case structure to enqueue the proper state for the consumer directly from the producer (State A with '1' and State C with '57').
2. Maybe you should change the Key Down notify event to a Key Down? filter event to discard the pressed key. Otherwise, it could have weird sideeffectes if the user has set the key focus to an editable control.
3. In order to prevent fals execution, you have to keep track if State A and State C are enqueued "properly" (read: only if State B is in execution). There are several ways to solve it. The one i recommend you is to keep a boolean in a shift register of the consumer, init it with FALSE. Once you execute State B, set it to true. Nest a case structure in State A and State C which queries that boolean. Once TRUE, execute the State's code, if FALSE, skip it. Set the boolean to FALSE in both State A and State C. Remember to assign TRUE to it in Start State, otherwise your first State A wont execute.
hope this helps,
Norbert
04-08-2015 02:49 AM
Thanks for your response
Here are my responses
1. I agree that notifier is an over kill, but it's a nice way to pass along information down to consumer loop.
But I think a case structure would complicate this further. Currently I have about 10 dialogue windows that I have to get rid of.
Most of them ask users to press Yes to keep going, or Cancel to stop the sequence and return to main menu.
Cancel is easy because it goes directly to the closing state. But keeping track of which state to go in the producer loop would cause a headache since this key entry would
cause a state transition to many different states.
2. That makes total sense.
3. Not exactly sure what you are referring to and why the state varible for boolean is necessary.
04-08-2015 02:59 AM
@doradorachan wrote:
[...]
Most of them ask users to press Yes to keep going, or Cancel to stop the sequence and return to main menu.
[...]
I recommended to get away from the notifier as you use it as a boolean switch. This does not scale.
I want to dig deeper for some advise:
State C is the final step of the sequence. This is also the case for your final application? Read: In case the user cancels, the last step in the sequence is to be called?
If so, there is a simple solution:
If Cancel is pressed at any time the sequence executes, you enqueue that last step of the sequence by the producer. The consumer feeds its sequence states by itself (as you already do for Start Sequence -> State A).
In case of the last step of the sequence, you flush the queue to get rid of possible invalid enqueued steps. Maybe you want to analyze the deleted elements for a "STOP" as this is something you want to re-enqueue.....
Norbert