基于检查状态关注文本字段和删除焦点

时间:2017-09-26 17:28:34

标签: swift xcode macos

我有checkbutton;当用户检查它时,我需要启用两个文本框,将焦点设置在第一个文本框并使其可编辑。 到目前为止,启用文本框并设置焦点是有效的。但是取消选中复选按钮时,焦点不会被删除,第一个文本框仍然可以编辑。

if(check_button.state==NSOnState)
        {
        txtone.isEditable=true
        txttwo.isEditable=true
        txtone.becomeFirstResponder()
        }
        else
        {
            txtone.resignFirstResponder()
            txtone.isSelectable=false
            txtone.isEditable =false
            txttwo.isEditable=false

        }

我做错了什么?

1 个答案:

答案 0 :(得分:2)

您正在为OSX编码,因此请尝试将此重点放在;WITH T AS ( select * from (select * from cards ) src pivot ( MAX(codes) for sequence_number IN ([1],[2],[3],...,[n])) pvt ) update b SET code_1 = T.[1], code_2 = T.[2], code_3 = T.[3], ...., code_n = T.[n] from boxes b inner join T ON b.service_id = T.service_id

NSTextField