Option to add more GPs to disable a button

Sometimes it would be really good if more than one GP could disable a button. I’d envisage the standard “+” / “x” icons (below) to allow GPs to be added or removed in the middle of this example section below:

Please might you consider this for v3.7, @Cattlesquat ?


That particular set of configurers (adding a group of things into a list) makes it more needing of @Brent_Easton efforts (Brent the whole thing is in AbstractToolbarItem if you end up having time to take a look)

There is a standard configurer- NamedKeyStrokeArrayConfigurer - that you can drop in via a static class implementing ConfigurerFactory. It saves it values as a comma delimited list, so a single property name automatically gets converted to a list of one property.

Hows do the multiple properties interact? Is the button disabled when any of the properties are true? or when all of the properties are true? or when at least X of the properties are true?

The requirement I had in mind was “when any of the values are true”.


Can’t this request simply be done by having the single global property currently implemented be a function…

Disable on X = True
X = A or B or C or D

If any of A/B/C/D is True, then X is True

So doesn’t Vassal already give you this capability without any changes???

No. No Calculator Icon on that field, so no expressions.

That field can only be a Global Property name and it is used to set a Property Change Listener on the named Global property so that as soon as the GP changes value, the button is notified and it refreshes itself to show it is disabled and prevents anyone clicking on it…

It would be possible to change that field to be an expression instead (essentially a Calculated Property), but there is no way to ‘listen’ for changes to a Calculated Property, so the the button would not appear to change after the disable conditions are met. We would have to add a check in the button push code to say ‘Oops, we where actually disabled, sorry, can’t do that’. It would not be a good user experience.

@Brent_Easton We need a list of properties, rather than a list of keystrokes, so I’m not sure how to use NamedKeyStrokeArrayConfigurer

If you did the configurer part of this (in AbstractToolbarItem), I could handle the logic for checking multiple properties, etc?