Search code examples
xcodeapplescriptapplescript-objc

How to hide a Label and show it when a button is pressed in AppleScript app?


I would like to know how to hide/show a label using AppleScript I tried something like:

property label : missing value
    if label's isHidden() = 1
                label's setHidden_(0)
            end if

but mot working.


Solution

  • To perform an AppleScript if expression you have to coerce ObjC BOOL to AppleScript boolean.
    But you can pass an AppleScript boolean in the setter.

    if label's isHidden() as boolean then -- is true is redundant 
       label's setHidden:false
    end if