still not sure how to pass commands through stack

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
magice
Posts: 457
Joined: Wed Mar 18, 2009 12:57 am

still not sure how to pass commands through stack

Post by magice » Tue Mar 31, 2009 5:58 pm

I have a main stack and a sub stack. I need for the cancel button on the substack to change the visibility of a graphic on the mainstack.

currently in the cancel button i call deleteRect.

then in the main stack script.

Code: Select all

on deleteRect
    global tRectInc
  
   do "set the visible of graphic Rect" & tRectInc & "  to false"

end deleteRect
(the tRectInc is a number that is incremented based on which rectangle is being modified)

The problem, is that I am getting a "no such object" error when the script runs. It is correctly seeing the object name, but does not detect that there is an object of that name. Earlier scripts are correctly modifying the object so there is no question that it exists and is properly named. I believe that the problem occurs because I am calling the command from a substack and trying to modify a graphic on the mainstack. Is there something I need to add for the "on deleteRect" script to look in the right place for the designated rectangle?

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4172
Joined: Sun Jan 07, 2007 9:12 pm

Post by bn » Tue Mar 31, 2009 7:10 pm

magice,
you dont indicate where the graphic is. If you call it from the card the graphic is on then it finds it, if the graphic is somewhere else you must tell rev where to find it.
set the visible of graphic (myrect & rectInc) of card x of stack y to false

please look up the reserved words of Rev. You use rect & something. Rect is a reserved word. If you would use myRect & something you would not have to code it with
do "mycode here"
actually eventually using reserved Keywords will bite you, dont do it, even if you get away with it in your workaround.
you make things more complicated then they are this way.
Look at the tutorials, they are very helpful.
regards
Bernd

Post Reply