EssentialGG / Vigilance

Configuration Utility using Elementa
GNU Lesser General Public License v3.0
54 stars 12 forks source link

The list of options in a selector can't be updated after initialisation #42

Open caoimhebyrne opened 2 years ago

caoimhebyrne commented 2 years ago

When defining a selector like shown below, once it's defined, the list of options stays the same, even if it's changed later on.

val options = listOf("1", "2", "3")

init {
    selector(
        ::foo,
        "Foo",
        "Bar",
        options = options
    )
    ...
}

It might be a good idea to be able to update a selector's list, as I can think of many cases where a data set may change over time.

One solution is passing options by a field reference, and then checking that field each time the configuration GUI is shown:

selector(
    ...
    options = ::options
)

This is open to suggestion, and I'd like to see what other people think is a viable solution to this problem.