xcodecocoaapplescriptnsbuttoncell

Applescript Cocoa Application NSButtonCell Not Setting Cell Transparent


I have been playing around in Xcode and currently working with NSMatrix's NSButtonCells but hitting a road block. I want a matrix that only shows 5 Radio Buttons on 2 lines. (Technically a 2 by 3 with one invisible) This is a changing Matrix that could have more or less radio buttons. So I am making something that will turn off unused radio buttons. It seems there is an call to NSButtonCell to make it transparent. (As read here:) If I make the NSbuttonCell transparent via the check box in the MainMenu.xib (side menu in xcode) I can make it transparent. Via a button press link to some code I can make it reappear. Here is my issue, I can't make it disappear again.

Currently this button action with tell me the radio button name (title) and then tries to turn it off

on buttonPress_(sender)
        set tempVar to codeOptionMatrix's cellAtRow_column_(1,0) -- variable to target correct NSbuttoncell
        log title of tempVar -- tell me the name of that cell so I know I got the right one
        tempVar's setTransparent_(true) -- make transparent
 end buttonPress_

As I mentioned, if I turn it transparent by side menu in Xcode and set the same button action to "setTransparent_(false)" it will reappear. Anyone have any in site why I am getting no errors and yet failing to turn it transparent.


Solution

  • Seems to be linked to the enabled element. The following works for me.

    on buttonPress_(sender)
            set tempVar to codeOptionMatrix's cellAtRow_column_(1,0) -- variable to target correct NSbuttoncell
            log title of tempVar -- tell me the name of that cell so I know I got the right one
            set enabled of tempVar to false
            tempVar's setTransparent_(true) -- make transparent
     end buttonPress_