Start Using

J. Landman Gay jacque at hyperactivesw.com
Sun Dec 12 20:45:59 EST 2004


On 12/12/04 11:10 AM, Gordon wrote:

> What's the difference between a command and a
> function- I even tried setting "setGlobal" back to a
> function and returning something, but then I got the
> old "handler not found" error again. I am confused
> about commands and functions - why are my functions
> not seen and which should I use and when?
> 

Commands and functions are almost exactly the same, except that a 
function formally returns a value. Commands can return values too, but 
don't worry about that yet. When you call a function in a script, it 
acts just like a variable. For example:

function myTime
  return the time
end myTime

Now I can use that function in a script just as though it were a variable:

   put myTime() into fld 1

I have an old essay on functions; if I can find it, I will post it here 
under its own topic heading.

> I don't mind having to pay for the rev manual, but
> couldn't they send it electronically to help users
> while they're waiting the 3-4 weeks it takes for the
> paper versions to arrive by snail mail. It's really
> hard trying to figure all this out from the
> documention window that comes with rev. It doesn't
> give any kind of overview of the Transcript language
> that one would need to understand enough to really get
> going. I am praying for my manuals to arrive a.s.a.p.

The manuals are printed versions of the online docs, and there isn't 
much difference. For an overview of transcript/stack concepts, the 
Shafer book is good. There is also quite a bit of information in the Rev 
docs if you look beyond the dictionary; try the FAQ, the object topics, etc.

About your original question regarding "in use" stacks:

When you put a stack in use, only the stack script itself gets shared. 
If your scripts are in a button or a card, putting the stack in use 
won't cause them to be "seen". There are two ways you can fix this.

The first way: put all the handlers you want to share into the script of 
the stack, not in any other place. Then when the stack is put in use, 
its stack script is available everywhere and all open stacks can use it.

The second way: insert the script of the object that has your shared 
handlers into the message hierarchy. If you are storing the handlers you 
want to share in a button script, then:

   insert script of btn "myLibScripts" of stack "mySharedStack" into back

This places the button script into the back of the message path and all 
your other scripts can use it.

Either method works. There are some subtle reasons to choose one method 
over the other, but it probably doesn't matter in this case.

-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com


More information about the use-livecode mailing list