Reputation: 21
I have 41 buttons that have to become Invisible when you click on them in VisualWorks. It is just one line doing this.
(self builder componentAt: #buttonWhichCalledTheMethod) beInvisible.
I have tried going with self
, but that is the whole form.
This context
also produce error does not understand
. Both happens after I click on the button.
Is there any way to use something as sender?
Upvotes: 0
Views: 87
Reputation: 2433
I’m not sure I fully understand what you try to achieve. It seems you try to use the same code to make the button invisible that triggered the method you are currently running. Due to decoupling of widgets and application code it’s not really possible to guess which button triggered a certain method. A simple solution would be to keep a dictionary where the selectors and button IDs are mapped and can be looked up.
The way these methods are called is via a block that’s created in #actionFor:
there the selector is passed, so if your buttons have the same ID as their selectors, you could override #actionFor:
to not only perform the key but also disable the button.
PS: don't ever use thisContext
or #doesNotUnderstand:
Upvotes: 0