2 questions

Cubist at aol.com Cubist at aol.com
Tue Mar 1 15:26:10 EST 2005


sez robmeyer at hetnet.nl:
>How to call a handler in a substack?
   "Send" is the keyword you want. As in:

  send "HandlerName" to substack "Fred" of stack "George"

   The thing to keep in mind with "send" is that you're sending a message (a 
string, that being "HandlerName" in my example), and you have to specifically 
identify *where you're sending it TO*. If you wanted to call a handler in a 
particular card of a substack, you'd send the message to (card "Harry" of 
substack "Fred" of stack "George"); if your intended target is a handler in a 
specific button of a particular card, you'd send to  (button "Zelda" of card "Harry" 
of substack "Fred" of stack "George"); and so on, and so forth. Rev's 
built-in "long name" function will tell you *exactly* how you should refer to a 
button/card/whatever so that "send" will *always* know where to go.

>In the stackscript I wrote:
>function content
>   return "field" &&quote&content&quote&& "of stack" &&quote&frontpage&quote
>end content
>returning: field "content" of stack "frontpage"
>
>The number of lines in field  "content" = 89
>but: put the number of lines of content()  puts 1
>but: put the number of lines of field "content" of stack "frontpage"  
>puts 89
>
>What did I do wrong with the function function.
   Nothing, really. In your "content" function, you're building a string and 
returning that string, and there is only one line in that returned string. 
Yes, the string you built is a valid field-name -- but Rev didn't realize that 
you want the contents of the field that's named by your string, because you 
didn't *tell* it so! Try this instead:

  return (field "content" of stack "frontpage")

   Hope this helps...


More information about the use-livecode mailing list