When is suspendStack sent?

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

When is suspendStack sent?

Stephen MacLean via use-livecode
Hi all.

I was using modal as a means to prevent a user from switching to another open window while in certain modes (editing a "form" for example). That is fraught with peril for a number of reasons I will not go into here.

So alternatively I thought to put a suspendStack handler in the stack script, then check for the condition and pop a dialog alerting the user, then issuing a go stack <whatever> to refocus on the stack.

The first time it works great. The second and subsequent times however, suspendStack is NOT getting sent! Why? Is it because the original stack is no longer the topStack?

Bob S


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: When is suspendStack sent?

Stephen MacLean via use-livecode
I'm still curious why suspendStack is not getting sent to what appears for all intents and purposes to be the topStack (I even click the titlebar to make sure), but I found a workaround which is a bit more elegant. If I have a substack open, say for editing the details of a site record, and I am in editing mode, I check for that back on the main stack (which displays summary information for all the primary modules) and I prevent a new datagrid selection on the main form if so.

Not sure if this helps anyone, but the second parameter in SelectionChanged (the old selection) really comes in handy here because I need to re-select the old selection. It's probably an edge case for me because I sync main stack selections with substack selections and vis versa, so the user doesn't think he's viewing or editing one record when he thinks he's editing another. Changing records in the middle of an edit therefore can corrupt data, overwriting one record with the contents of another while saving.

Bob S


> On Sep 20, 2018, at 09:02 , Bob Sneidar via use-livecode <[hidden email]> wrote:
>
> Hi all.
>
> I was using modal as a means to prevent a user from switching to another open window while in certain modes (editing a "form" for example). That is fraught with peril for a number of reasons I will not go into here.
>
> So alternatively I thought to put a suspendStack handler in the stack script, then check for the condition and pop a dialog alerting the user, then issuing a go stack <whatever> to refocus on the stack.
>
> The first time it works great. The second and subsequent times however, suspendStack is NOT getting sent! Why? Is it because the original stack is no longer the topStack?
>
> Bob S


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: When is suspendStack sent?

Stephen MacLean via use-livecode
In reply to this post by Stephen MacLean via use-livecode
Bob.

Is the suspendStack handler in the stack script of some stack? If so, it
will only fire when leaving that stack.

You can always place the handler in a backScript, or something similar, so
that all stacks will have to listen to it.

Craig



--
Sent from: http://runtime-revolution.278305.n4.nabble.com/Revolution-User-f278306.html

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: When is suspendStack sent?

Stephen MacLean via use-livecode
Yes it's in the stack script. It works the first time, and subsequent times it does not fire, even when I click back on the stack and away from it again. I think the stack I clicked on to go away from it is somehow getting the suspendStack message instead of the stack that is *actually* suspending. I'll have to test later.

Bob S


> On Sep 20, 2018, at 10:40 , dunbarxx via use-livecode <[hidden email]> wrote:
>
> Bob.
>
> Is the suspendStack handler in the stack script of some stack? If so, it
> will only fire when leaving that stack.
>
> You can always place the handler in a backScript, or something similar, so
> that all stacks will have to listen to it.
>
> Craig


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: When is suspendStack sent?

Stephen MacLean via use-livecode
Hmmm.

Not sure of your setup, of course, but if I try an experiment, it always
works. Can you check the topStack each time you return to the, er, topStack?
You may indeed need to place that handler in a backScript or stack in use in
order to do so.

Craig



--
Sent from: http://runtime-revolution.278305.n4.nabble.com/Revolution-User-f278306.html

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: When is suspendStack sent?

Stephen MacLean via use-livecode
I just set up a couple stacks and it worked every time. Then I switched to another application and then the messages stopped. I will need to go back and see if I can reduce to a recipe.

The dictionary says the message is sent to the card, so the stack should see it.

Thanks,
Brian
On Sep 20, 2018, 4:35 PM -0500, dunbarxx via use-livecode <[hidden email]>, wrote:

> Hmmm.
>
> Not sure of your setup, of course, but if I try an experiment, it always
> works. Can you check the topStack each time you return to the, er, topStack?
> You may indeed need to place that handler in a backScript or stack in use in
> order to do so.
>
> Craig
>
>
>
> --
> Sent from: http://runtime-revolution.278305.n4.nabble.com/Revolution-User-f278306.html
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: When is suspendStack sent?

Stephen MacLean via use-livecode
I put the suspendStack handler in the card instead. Same thing. Seems the suspendStack message is only getting sent once for every different stack I switch to. For instance, I can click the window of the mainstack while in a substack and I get the suspendStack message. Subsequent clicks however do NOT get sent. But if I click a DIFFERENT stack, say the script editor, I DO get the suspendStack message. Subsequent clicks to ANY of the stacks, once clicked in do NOT generate a suspendStack message.

What's even more interesting is that after clicking the script editor as the second alternate window clicked (the first being the mainstack) the titlebar of the mainstack is WHITE not the usual grey 3d look, and remains this way until it becomes the only open window.

I think what is happening is that the topstack gets changed the first time I click an alternate window and does not change until I close that window the way it should. That is why suspendStack is not getting sent a second time to the stack that *appears* to be on top. Another stack is the topStack.

Once *ANY* stack gets a suspendStack message the first time, it never seems to get subsequent messages. I am going to add the handler to a backscript later to see who is getting the message and where it is going.

Bob S


> On Sep 20, 2018, at 14:53 , Brian Milby via use-livecode <[hidden email]> wrote:
>
> I just set up a couple stacks and it worked every time. Then I switched to another application and then the messages stopped. I will need to go back and see if I can reduce to a recipe.
>
> The dictionary says the message is sent to the card, so the stack should see it.
>
> Thanks,
> Brian
> On Sep 20, 2018, 4:35 PM -0500, dunbarxx via use-livecode <[hidden email]>, wrote:
>> Hmmm.
>>
>> Not sure of your setup, of course, but if I try an experiment, it always
>> works. Can you check the topStack each time you return to the, er, topStack?
>> You may indeed need to place that handler in a backScript or stack in use in
>> order to do so.
>>
>> Craig
>>
>>
>>
>> --
>> Sent from: http://runtime-revolution.278305.n4.nabble.com/Revolution-User-f278306.html
>>
>> _______________________________________________
>> use-livecode mailing list
>> [hidden email]
>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: When is suspendStack sent?

Stephen MacLean via use-livecode
Hi.

"...For instance, I can click the window of the mainstack while in a
substack and I get the suspendStack message. Subsequent clicks however do
NOT get sent."

Now I am not sure what you mean. If I have a mainstack with a suspendStack
handler in the stack script, and one or more sub stacks, that handler will
fire whenever I navigate among any of them. In your example above, you would
have suspended the subStack when you clicked on the main stack. But repeated
clicks in any one stack will not, as expected, fire that hander. There has
been no navigation, and therefore no suspension.

But is that what you meant by "subsequent clicks", that is, subsequent
clicks on the same stack?

In other words, is that handler in the message path of the stacks that you
are navigating among? I have never seen any anomalies with that message
during navigation from stack to stack, as long as the handler is in the
message path.

Craig



--
Sent from: http://runtime-revolution.278305.n4.nabble.com/Revolution-User-f278306.html

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: When is suspendStack sent?

Stephen MacLean via use-livecode
Hi Craig. No what I am doing is when suspendStack fires, I check a property in the current stack. If it is not "view" I pop a dialog (as sheet) alerting the user thet they have unsaved changes, then I go to the stack (otherwise it will navigate away which is what I am trying to prevent).

I'm thinking I can use a send in time as it may be that going back to the stack while suspendStack is executing bay be borking the engine somehow. All kinds of nasties start happening, like if I navigate to the script editor under these circumstances, I seem to lose the ability to grad and drop script selections. One time typing in a field actually edited the script!

Bob S

> On Sep 21, 2018, at 11:03 , dunbarxx via use-livecode <[hidden email]> wrote:
>
> Hi.
>
> "...For instance, I can click the window of the mainstack while in a
> substack and I get the suspendStack message. Subsequent clicks however do
> NOT get sent."
>
> Now I am not sure what you mean. If I have a mainstack with a suspendStack
> handler in the stack script, and one or more sub stacks, that handler will
> fire whenever I navigate among any of them. In your example above, you would
> have suspended the subStack when you clicked on the main stack. But repeated
> clicks in any one stack will not, as expected, fire that hander. There has
> been no navigation, and therefore no suspension.
>
> But is that what you meant by "subsequent clicks", that is, subsequent
> clicks on the same stack?
>
> In other words, is that handler in the message path of the stacks that you
> are navigating among? I have never seen any anomalies with that message
> during navigation from stack to stack, as long as the handler is in the
> message path.
>
> Craig


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode