[comp.sys.mac.hypercard] Can a HyperTalk FUNCTION be global ?

Ilan@cup.portal.com (ilan - rabinowitz) (11/04/88)

I would like to define a HyperTalk function in any Stack
and be able to access it by its name from any background,
button, or card, and as many times as I need to.

Is there a way to create this type of a "global" function
if the current HyperTalk language does NOT support it ?

I do NOT want to create an XCMD or an XFCN.                          

By the way, as documented in Danny Goodman's book
I should be able to call a function globally from anywhere
if the function is in the Home Stack.  I managed to make
that work.  But if I try the same thing in another stack
(other than the home stack) the function placed in the
stack script is never found by the button script or
card script calling it. (I used the factorial example
in Danny's book.)


  - Ilan Rabinowitz -
  Ilan@cup.portal.com

dan@Apple.COM (Dan Allen) (11/05/88)

HyperTalk functions can be global to different entities depending upon
where you put the function.  Read the docs about the inheritance path
for the full answers, but in short, 

	* A function in a stack is global to all cards, bgs, fields,
	  etc that are in THAT stack

	* A function in the home stack can be used across all stacks,
	  backgrounds, fields, buttons

In both these cases the function should be in the stack script of the
appropriate stack.

You can get around the standard inheritance path by the use of the
"send" keyword.

Dan Allen
Apple Computer