I've been trying to remove a slot from a child button click, but I can't seem to get it to work. E.G.
flow do
button("X") {parent.remove}
end
Any suggestions?
I've been trying to remove a slot from a child button click, but I can't seem to get it to work. E.G.
flow do
button("X") {parent.remove}
end
Any suggestions?
Shoes' blocks are sometimes tricky. The key here is to ask yourself, what is the parent method being called upon? self
, of course. And self references the app (or window, or dialog), not the button.
There are two similar ways to get around this. First, you can create a reference to the button to use in the block:
flow do
a = button("X") {a.parent.remove}
end
Or, you could just reference the slot itself:
b = flow do
button("X") {b.remove}
end