首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用applescriptobjc实现GDC

使用applescriptobjc实现GDC
EN

Stack Overflow用户
提问于 2016-08-10 10:57:29
回答 1查看 58关注 0票数 0

我正在制作这个简单的ApplescriptObjC可可应用程序只是为了让我理解多踏步,它是一个文本字段和一个标签,我试图在文本字段中输入的同时实时更新标签,但它只在我按下enter键后才会更新,但不是实时更新,知道我如何才能做到这一点吗?下面是代码。谢谢

代码语言:javascript
复制
    script AppDelegate

    property parent : class "NSObject"
    property prgLabel: missing value
    property subjectFeild: missing value


    on applicationWillFinishLaunching_(aNotification)
        -- Insert code here to initialize your application before any files are opened  
    activate
  end applicationWillFinishLaunching_

    on applicationShouldTerminate_(sender)
        -- Insert code here to do any housekeeping before your application quits 
        return current application's NSTerminateNow
    end applicationShouldTerminate_

    on textChange_(sender)

        set SU to subjectFeild's stringValue() as string
        prgLabel's setStringValue_(SU)

    end textChange_


end script
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-09-02 00:26:25

1)将文本字段的委托设置为您的应用委托。

2)实现controlTextDidChange,在编辑过程中每次文本字段发生变化时都会调用。

代码语言:javascript
复制
script AppDelegate
    property parent : class "NSObject"

    -- IBOutlets
    property theWindow : missing value
    property prgLabel: missing value
    property subjectFeild: missing value

    on applicationWillFinishLaunching:aNotification
        subjectFeild's setDelegate:me
    end applicationWillFinishLaunching_


    on controlTextDidChange:notification
        prgLabel's setStringValue:subjectFeild's stringValue()
    end

end script
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/38863544

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档