toParm Button vs Action?

What is the rationale behind this code? So that the code executed on click might depend (for example) on the label of a Button?

1 Like

So that your called method can take the original button and/or action as a parameter. There can be a bunch of reasons to do that and it’s a very common pattern.

Maybe you’ve got a subclass that you want to access the data. Maybe you’ve added user added data.

Any of a dozen reasons.

2 Likes