Like with many programs, I would like to at one stage disable controls so that the user cannot mess around with them while processing is taking place. To do this, I created the following property:
property enabledSearchComponents: true
And I set it as the delegate for the the control I want to use (http://note.io/1fjI4UW).
This works fine when the program starts, but later on when I set the property to false - it does absolutely nothing. Did I misinterpret how delegates work in this scenario or is there something I need to call in order for the GUI to refresh?
Thanks in advance!
First, you want to get the terminology right, or you’ll confuse yourself in future. That’s nothing to do with delegates – that’s a Cocoa binding.
What sort of control are you binding?
Thanks for the clarification Shane.
I am trying to bind the enabled state of an NSButton to the enabledSearchComponents property.
The binding works as when the program starts, the button’s enabled state is dependent on the value of enabledSearchComponents.
Later on, when I change the value of enabledSearchComponents to false, nothing happens - and I don’t understand if something should happen just by doing that.
It should. Post the line of code that changes it.
Here’s the code:
set enabledSearchComponents to false
And here is a small video showing my settings:
Thanks again for looking!
Change that to:
set my enabledSearchComponents to false
Without the my, nothing happens.
Funny bit about this is that I was just reading about it on your book! (Page 26).