SubStacks and message path

Jim Ault jimaultwins at yahoo.com
Sat Jun 4 07:22:59 EDT 2011


> On 4 Jun 2011, at 09:07, Keith Clarke wrote:
>
>> Hi folks,
>> I'm using a substack 'Credentials' as a dialogue box to capture  
>> login credentials for a web service (tUsername, tPassword).
>>
>> A second 'SOAP' substack acts as a library managing the various  
>> POST messages for the web service, including a function login  
>> pUsername pPassword
>>
>> If I attempt to use 'do login(tUsername, tPassword)' in a button on  
>> the Credential's substack, the script throws errors - so I'm  
>> assuming that the SOAP substack is not in the Credentials  
>> substack's message path.
>>
>> So, I'm trying the call function for the first time, but get errors  
>> with call login(tUsername, tPassword) of stack "SOAP"
>>
>> Any clues as to what I'm dong wrong?
>> Best,
Keith..

No need for fancy maneuvers.  Just use the straight forward approach.
You could do a simple one-liner in the 'on openstack' of the SOAP  
stack script.
   start using stack (the short name of me)

If you do this in the main stack, then use
         start using stack "SOAP functions"
-- this puts only the stack script into the 
'library' part of the message path
Now that script container will be after ANY main stack & substacks you  
open.

The path will be
    main stack, then SOAP, then back, then engine

unless the SOAP stack is front most window, then
   SOAP stk, main stack, then SOAP, then back, then engine
-- thus twice, if and only if you pass your handler and function traps

Switch to another main stack and SOAP remains in the path.
    main stack 2, SOAP stk, then back, then engine

The best practice is to keep SOAP in memory rather than close it after  
executing "start using", unless you execute "stop using", then close.   
Otherwise, Livecode will try to keep the stack open in memory, since  
you said you needed it.

Hope this helps

Jim Ault
Las Vegas






More information about the use-livecode mailing list