Scope Problem on Standalones

David Burgun dburgun at dsl.pipex.com
Mon Nov 28 07:51:58 EST 2005


Hi All,

I still can't get this to work.

The folder structure is:

MacOSX/myApp.app  <-- bundle
MacOSX/myApp.app/Contents/MacOS/MyApp (real applicaiton)
MacOSX/myApp.app/Contents/MacOS/Runtime/Stacks/StackA.rev
MacOSX/myApp.app/Contents/MacOS/Runtime/Stacks/StackB.rev
MacOSX/myApp.app/Contents/MacOS/Runtime/Stacks/StackC.rev

The path I get returned from "filename of this stack", in the 
openStack (or preOpenStack) script of Card 1 of  StackA.rev is:

path/MacOSX/myApp.app  <-- bundle

Bu according to the documentation, the path returned should be the 
path to the real application, e.g.

MacOSX/myApp.app/Contents/MacOS/Runtime/Stacks/StackA.rev

Or perhaps:

MacOSX/myApp.app/Contents/MacOS/MyApp (real applicaiton)

Have I got this wrong? I would be really grateful if someone could 
just let me know if:

a) The documentation is correct.
b) If no, how I acheive this!
c) if yes, why doesn't it work!

At my wits end for something to try to solve this!

I have everything else more or less done, this is the last remaining 
problem (AFAIK!).

I am running under the lastest version of MacOS X Tiger and the 
lastest version of RunRev.

Help!

Thanks a lot in Advance
All the Best
Dave
-------------------------------------------------------------

Some more information:

I moved the call to LoadGlobalStacks() to the openStack handler in 
card 1 of StackA.rev, the same thing happens, works fine under IDE 
but not when run as a standalone.

Upon further inspection, I found that after :

  function LoadGlobalStacks
  local myStackFIlePathName
   local myStackFIlePath
   local myGlobalStackFilePathName

put the filename of this stack into myStackFIlePathName
put myStackFIlePathName into myStackFIlePath
set itemDelimiter to :/"
delete item -1 of myStackFIlePath
set itemDelimiter to ","

Has been run, myStackFIlePathName is equal to myStackFIlePathName, in 
other words the last item has NOT been deleted! I changed it to:

put empty into item 1 of myStackFIlePath

But this doesn't work either!

I am testing this using answer dialogs since I can't run the debugger 
in the standalone and it works fine in the IDE.

This an additional problem to the filename of the stack being 
inconsistent with the current stack. Why should a simple delete 
statement work under the IDE but not in Standalone mode?

I am sure this has worked in the past, although I am not sure that I 
have tried it as a standalone since I upgraded to the lastest version 
of RunRev.

Any ideas anyone?

(there are some typeos in the code below, it's just a problem of 
re-typing, not in the real script I am running)

Thanks a lot
All the Best
Dave

Hi,

I have an application that is comprised on a number of stacks.

The top level stack is built into a Standalone and it calls other 
stacks (.rev files) via "start using" and "go stack" commands.

When in the IDE the folder stucture is like this:

BaseFolder/StartUp.rev <-- just contains a splash screen
BaseFolder/Runtime/Stacks/StackA.rev
BaseFolder/Runtime/Stacks/StackB.rev
BaseFolder/Runtime/Stacks/StackC.rev

StartUp.rev figures out the correct path (by using the filename of 
this stack property) and does a goto StackA.rev.
StackA in turn does a go to StackB.rev. This all works fine under the IDE.

When runnig as a standalone the folder structure is like this:

MacOSX/myApp.app  <-- bundle
MacOSX/myApp.app/Contents/MacOS/MyApp (real applicaiton)
MacOSX/myApp.app/Contents/MacOS/Runtime/Stacks/StackA.rev
MacOSX/myApp.app/Contents/MacOS/Runtime/Stacks/StackB.rev
MacOSX/myApp.app/Contents/MacOS/Runtime/Stacks/StackC.rev


But when I run this StackB.rev does not get found/run.

I traced this down to some code in card 1 (the only card) of StackA.rev:


function LoadGlobalStacks
   local myStackFIlePathName
   local myStackFIlePath
   local myGlobalStackFilePathName

put the filename of this stack into myStackFIlePathName
put myStackFIlePathName into myStackFIlePath
set itemDelimiter to :/"
delete item -1 of myStackFIlePath
set itemDelimiter to ","

put myStackFIlePath & "/StackB.rev" into myGlobalStackFilePathName
if there is not a stack myGlobalStackFilePathName return false

start using myGlobalStackFilePathName

return true
end LoadGlobalStacks


on preOpenStack
    if LoadGlobalStacks() = false then
   answer error "Cannot Find Global Stacks"
   end if

set the menubar of this stack to "MainMenu"

end preOpenStack


The problem seems to be that in the LoadGlobalStacks() function the 
string returned from:

put the filename of this stack into myStackFIlePathName

is "MacOSX/myApp.app" and not

"MacOSX/myApp.app/Contents/MacOS/Runtime/Stacks/StackA.rev" as expected.

I am guessing it's something to do with scope and being called from a 
preOpenStack handler??? StackA.rev was enetered via a go stack 
path/StackA from MacOSX/myApp.app and it looks like this context is 
being used instead of the context of StackA.rev.

If so, what is the recommended way of doing this?? If not what am I 
doing wrong?

Thanks in advance for any help.

All the Best
Dave
















_______________________________________________
use-revolution mailing list
use-revolution at lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your 
subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
_______________________________________________
use-revolution mailing list
use-revolution at lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your 
subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution



More information about the Use-livecode mailing list