Quantcast

Dispatching Messages to Closed Stacks Which Are Not in Memory

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Dispatching Messages to Closed Stacks Which Are Not in Memory

Richmond Mathewson via use-livecode
I just discovered something fascinating.

Stack "Gems" is in the stack files but closed, in fact all stacks in this modular frame work are set to destroy window and stack on close.

-- look at project browser: confirmed… stack Is *not* open

Stack "gems" has this in it's stack script:

on journalResume
-- see close card to look at values passed to the dbase that are returned here
-- triggered from model_SivaSivaJournal with
-- dispatch "journalresume" to stack tEntryA["module"] with tDataA, tEntryA
answer "Got the Resume Message" with "OK"
end journalResume

OK now… in stack "Journal" (think of it like a super robust history of user's activities ala OLP child system)

we have this

dispatch "journalresume" to stack tEntryA["module"] with tDataA, tEntryA

which in this case will be

dispatch "journalresume" to stack "gems" with tDataA, tEntryA

which when fired, triggers the

journalResume

handler in stack "gems"

*even though it is not open*

how can that be?

BR
_______________________________________________
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
|  
Report Content as Inappropriate

Re: Dispatching Messages to Closed Stacks Which Are Not in Memory

Richmond Mathewson via use-livecode
On 5/15/17 10:28 AM, Sannyasin Brahmanathaswami via use-livecode wrote:

> we have this
>
> dispatch "journalresume" to stack tEntryA["module"] with tDataA, tEntryA
>
> which in this case will be
>
> dispatch "journalresume" to stack "gems" with tDataA, tEntryA
>
> which when fired, triggers the
>
> journalResume
>
> handler in stack "gems"
>
> *even though it is not open*
>
> how can that be?


Any reference to a stack will re-open it. The reference here is in the
dispatch command.

--
Jacqueline Landman Gay         |     [hidden email]
HyperActive Software           |     http://www.hyperactivesw.com

_______________________________________________
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
|  
Report Content as Inappropriate

Re: Dispatching Messages to Closed Stacks Which Are Not in Memory

Richmond Mathewson via use-livecode
right, I can see the stack in the project browser after the dispatch call but it is not actually open as a top stack… what doesn't make sense is that

a) there is no dictionary word "open"

b) but if you run

open "gems" in the msg box it opens the stack in the GUI as the top stack

c) If you close the stack and remove from memory but run "dispatch" some handler to that stack

"re-opens" but is not open in the GUI as a top stack…
 Yes it's stack script is available for us to talk to;
but it is not "really" open in the way that

open "gems" opens it. OK…

d) I suspect it is open in mode 0

- **Mode 0: closed but loaded**

confirmed: put the mode of stack "gems"
[returns] 0

so "re-open" is misleading.. it is closed but loaded (new concept for me after 30 years of xtalk!)

so what is the optimum option (especially for mobile) to show the stack after loading it?  

"Go me"  or  "toplevel me"  
 
neither work  in the handler in the stack "gems") which is in mode 0…   "me" seems to continue to refer to the stack issuing the dispatch (stack "journal")

I have to pass an explicit reference to the stack  by using it's own name that is loaded but not open…  

so our generic "journalResume" handler now looks like this where

this script is in the stack "gems" that is "closed but loaded"

and pEntryA["module"] = "gems"

on journalResume  pDataA, pEntryA
   answer "Got the Resume Message" with "OK"
   go stack  pEntryA["module"]  
end journalResume

that works… and the logic makes sense.

but seems like we have to work too hard…
would be neater to have a way to dispatch and toplevel at the same time.

i.e. " Executing a dispatch command causes the message to be sent to the
target object with the given argument list."  have dispatch also be able to set the mode of the stack it is sending the message to.

BR







 

On 5/15/17, 8:15 AM, "use-livecode on behalf of J. Landman Gay via use-livecode" <[hidden email] on behalf of [hidden email]> wrote:

    Any reference to a stack will re-open it. The reference here is in the
    dispatch command.

_______________________________________________
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
|  
Report Content as Inappropriate

Re: Dispatching Messages to Closed Stacks Which Are Not in Memory

Richmond Mathewson via use-livecode
I think you are confusing the meaning of "open" with "running in the IDE". Library stacks open but may have no windows or controls created in the IDE. In fact a script only stack has no graphical elements at all. "Open" means "Open as a file that loads into memory".

Bob S


> On May 15, 2017, at 20:47 , Sannyasin Brahmanathaswami via use-livecode <[hidden email]> wrote:
>
> "re-opens" but is not open in the GUI as a top stack…
> Yes it's stack script is available for us to talk to;
> but it is not "really" open in the way that

_______________________________________________
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
|  
Report Content as Inappropriate

Re: Dispatching Messages to Closed Stacks Which Are Not in Memory

Richmond Mathewson via use-livecode
Bob:    I think you are confusing the meaning of "open" with "running in the IDE". Library stacks open but may have no windows or controls created in the IDE. In fact a script only stack has no graphical elements at all. "Open" means "Open as a file that loads into memory".
   
Indeed, I have been under that misconception for a long time. and true, that was obvious for any files that have no LiveCode GUI layer component (script only stacks, text files), but was unexpect for stack that have actual cards/controls, especially since… all these years "open someStack" has been a common thing for me to do from the msg box.

 Also I would not say "IDE" but in the "UI space" because is not limited to the IDE.

then why does

open "some stack"  in the msg box  toplevel it?  

Enhancement "idea" still stands…

Simple way to toplevel (or open in any mode other than 0)  stack A with "dispatch " from another stack B

And since : open SomeStack toplevels it from the msg box, why not from script?

BR



_______________________________________________
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
|  
Report Content as Inappropriate

Re: Dispatching Messages to Closed Stacks Which Are Not in Memory

Richmond Mathewson via use-livecode
In reply to this post by Richmond Mathewson via use-livecode
On 5/15/17 10:47 PM, Sannyasin Brahmanathaswami via use-livecode wrote:
> ut seems like we have to work too hard…
> would be neater to have a way to dispatch and toplevel at the same time.

They serve different purposes. "Dispatch" controls the message path.
"Open" controls the state of the stack in the UI. There are many
instances where you do not want the stack toplevel or even visible but
you do want it to be in the message path.

Dispatch and "send" are similar. You would not expect a stack to
toplevel itself every time you send a message to it.

--
Jacqueline Landman Gay         |     [hidden email]
HyperActive Software           |     http://www.hyperactivesw.com


_______________________________________________
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
Loading...