0

我在一个名为“loader”的堆栈中有一个脚本,我想在另一个名为“theData”的堆栈中创建一张新卡。如果我只是使用create card在堆栈“加载器”中创建的卡。如何指定在堆栈“theStackName”中创建新卡?

就像是

on mouseUp
   put field "theStackName" into tStack

   create stack tStack with background "BGdata"
   -- the background "BGdata" which has been defined before
   -- contains a field "data"

   set the defaultStack to tStack

   put "something" into field "data"

   create card
   put "somethingElse" into field "data" 
end mouseUp
4

3 回答 3

2

有几种方法可以做到这一点,都使用create card命令。

方法一

您可以导航到目标堆栈,可能会锁定屏幕以便没有任何变化,然后在那里创建卡片。这具有能够在目标堆栈中的任何位置创建新卡的优势,目标堆栈可能已经有几张卡。如果您愿意,您可以随时返回起始位置。

或者您可以:

方法二

set the defaultStack to "theData"
create card

类似的事情。

于 2013-05-20T15:32:55.170 回答
1

Where did the field "data" come from? It would not be present in a newly created stack.

When you create a new stack, it becomes the topmost, or default stack. So you cannot just put something into a field unless you first create that field.

I assume your error was something like:

execution error... (Chunk: no such object) near "data".

If you are creating new stacks as well as new cards in a remote stack, well and good. Experiment with all this. Write back if you get stuck.

Craig Newman

于 2013-05-21T03:30:49.920 回答
0

据我所知,如果不在该堆栈中,就无法在堆栈中创建对象。创建新堆栈后,我会执行以下操作:

push card
lock messages
lock screen # optional but probably a good idea
go invisible stack "mynewstack"
create card "foo"
# at this point you'll be on that card
create field "data"
put "stuff" into field "data"
group field "data"
set the name of field "data" to "bgData"
pop card
unlock messages
unlock screen

所以本质上你会去新的堆栈并在用户背后做一些事情。但它很快,应该看起来是瞬间的。

于 2013-05-22T15:31:38.590 回答