jumping among Mainstack and substacks isn't easy

Bob Sneidar bobs at twft.com
Mon Jun 18 15:03:44 EDT 2012

I'm not entirely sure this is the issue, but let me describe how Livecode interprets your code. When you say "field boy", Livecode translates that to "field "boy" of the current card of the topstack" (others will correct me if I am wrong). LC allows you to do this for the sake of brevity in coding, so you do not have to spell out the full path to every object in order to use it. But it's something you need to keep in mind when you being to navigate to different cards in a script. 

If the card you navigate to does not have a field named "boy" when the script executes, you will get this error. Also, you should develop the habit now of putting quotes around your object names, because you may at some point use a reserved word for a field name, and LC will probably not even compile your code at that point. 


On Jun 18, 2012, at 11:12 AM, Mark Rauterkus wrote:

> Hi,
> My database for camper kids is progressing, but some newbie head
> scratching is in full force.
> Cards in a mainstack keep contact info and attendance details, one
> card per person. This seems to be working fine, except when I jump to
> different substacks. Then an error occurs. Case in point: I am
> building a "FIND" sub-stack, with one card. But I want to make a list
> of all the cards in the stack and take to the other stack and load it
> into a custom property in a field. Got it working, sorta.
> But on the way between stacks, I get weird errors. This is one.
> ...
> on openCard
>   get field boy
>   if it = 1 then set the hilite of button male to true else set the
> hilight of button male to false
> end openCard
> ...
> ...
> Debugger says: Stack "Kids": execution error at line 3 (Chunk: no such
> object) near "boy", char 4
> Perhaps I should do on preOpenCard?
> = =
> Q2: I could not figure out how to call a custom property of a field of
> the mainstack while working in a substack. So, my workaround was to
> make a hidden field in the substack that also had the same field
> custom property. I set it once and then went to the other stack and
> set it again.
> on mouseUp
>   put "" into index1
>   get the number of cards in this stack
>   put it into tRepeats
>   Repeat for tRepeats
>      global index1
>      go to next card
>      put (the short name of this card) & return after index1
>   end repeat
>   -- Generates first name sorting
>   sort index1
>   set the cNewmanList2 of field NewmanResults to index1
>   Open Stack Quickie_Finder
>   set the cNewmanList2 of field NewmanResults to index1
> end mouseUp
> Notice above that the last line is called twice, once for each stack.
> The debugger error in Q1 also comes when this scrip is called. It is a
> button to go to a FIND substack of one card.
> Thanks for any clarification.
> --
> Ta.
> Mark Rauterkus       Mark.Rauterkus at gmail.com
> PPS Summer Dreamers' Swim and Water Polo Camp Head Coach with
> Neighborhood Learning Alliance
> http://NeighborhoodLearning.org
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

More information about the use-livecode mailing list