【问题标题】:AppleScriptObjC: ProgressBar does not incrementAppleScriptObjC:ProgressBar 不增加
【发布时间】:2016-10-18 10:04:03
【问题描述】:

我正在尝试在 AppleScriptObjC 中实现进度条更新。我已经通过 IB 连接了进度条,并尝试通过 incrementBy(5) 增加进度条更新。 Inderterminate 属性设置为 false。 IB 连接很好,因为如果我将 Inderterminate 设置为 true 并取消注释启动/停止动画的代码,它工作正常。这是我得到的错误“-[NSProgressIndicator incrementby:]: unrecognized selector sent to instance 0x2007e2220”

下面是代码

property ProgressBar : missing value

on MyBtnClick_(sender)

(*.. some code ..*)

ProgressBar's incrementby_(5)
ProgressBar's displayifNeeded()

--ProgressBar's startAnimation_(me)

--ProgressBar's stopAnimation_(me)

end MyBtnClick_

感谢 Adv 的任何指点。

问候, 杰西

【问题讨论】:

    标签: xcode applescript applescript-objc


    【解决方案1】:

    试试 incrementBy_ -- 大小写很重要。

    【讨论】:

      【解决方案2】:

      好的,“无法识别的选择器发送到实例”意味着发送的命令是未知的,因此您发送给它的命令意味着它不存在,但是如果您尝试发送消息以使进度条设置它进度%那么,我可以帮助你! :D,我使用“setDoubleValue”命令来设置进度条状态,你也不需要 startAnimation 和 stopAnimation :D

      好的,这里有一个脚本,它将存储当前进度,当 MyBtnClick 运行时,它会在进度条上增加 5%

      property ProgressBar : missing value
      property currentProgress : 0
      
      on MyBtnClick_(sender)
      
      (*.. some code ..*)
      
      set currentProgress to currentProgress + 5
      ProgressBar's setDoubleValue_(currentProgress)
      
      end MyBtnClick_
      

      希望这会有所帮助:D

      【讨论】:

        猜你喜欢
        • 2021-07-04
        • 1970-01-01
        • 2020-02-14
        • 1970-01-01
        • 2023-03-13
        • 2011-06-02
        • 2013-05-30
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多