Why isn't bindText working here?

row {
            textField()
                .widthGroup("value")
                .bindText(
                    getter = { builder.value as? String ?: "" },
                    setter = { builder.value = it }
                )
                .onChanged { onSave() }
        }

The setter on this textField is not being called when I type into the resulting text field?

Am I missing something?

Bind is called when press OK, if you need the value when type you need to register a listener on the component (if I remember correctly DocumentListener or similar).

Press Ok on what? I am not using any dialog.

Mainly the panel created is a DialogPanel and bind is performed on apply on the dialog panel. If you need it I think you have to call it (and the call will also perform validation code if any).

I’m not sure I follow, call what?

apply() method on the DialogPane

1 Like