【问题标题】:How to get list card of stack ? - livecode如何获取堆栈列表卡? - 实时代码
【发布时间】:2014-05-09 04:11:56
【问题描述】:

我想按名称获取列表卡和列表对象。

之前。我问“如何找到项目浏览器的堆栈?-livecode”。我可以做到。

现在。我想按名称获取列表卡和列表对象。

谁能给我显示示例代码?

这是我获取此堆栈卡片数量的代码

answer the number of cards of this stack

但是我的代码这个错误是为了获取名片

answer the name of cards of this stack

-------我可以解决这个问题-------

on mouseUp
   put the number of cards of this stack into numC
   repeat with crd = 1 to the number of cards of this stack
      answer the name of card crd
   end repeat
end mouseUp

【问题讨论】:

    标签: livecode


    【解决方案1】:

    下面是一个示例,它创建了一个以堆栈卡名称作为键的数组。每个数组元素都包含卡片的控件列表。

    on mouseUp
       local tCurrentStack, tCards, tCurrentCard, tControlsA
    
       put "MyStack" into tCurrentStack
       put the cardNames of stack tCurrentStack into tCards
       repeat with tCardIndex = 1 to the number of lines in tCards
          put line tCardIndex of tCards into tCurrentCard
          repeat with tControlIndex = 1 to the number of controls in card tCurrentCard of stack tCurrentStack
             put the name of control tControlIndex of card tCurrentCard of stack tCurrentStack & LF after tControlsA[tCurrentCard]
          end repeat
       end repeat
    end mouseUp
    

    显示卡“MyCard”中的控件...

    put tControlsA["MyCard"]
    

    【讨论】:

    • 不错的脚本。我必须给每张卡一个不带空格的名字,否则脚本会失败——因为表达式card tCurrentCard 不能处理带空格的名字。我想知道是否有可能使这个脚本对card id 1013等默认卡名更具弹性
    猜你喜欢
    • 1970-01-01
    • 2018-05-30
    • 1970-01-01
    • 1970-01-01
    • 2010-09-18
    • 1970-01-01
    • 2014-08-12
    • 2023-03-08
    • 2012-12-19
    相关资源
    最近更新 更多