Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable field or group #422

Open
mavek87 opened this issue May 5, 2022 · 1 comment
Open

Disable field or group #422

mavek87 opened this issue May 5, 2022 · 1 comment

Comments

@mavek87
Copy link

mavek87 commented May 5, 2022

Hello, is it possible to disable a field (setting) or a group?

@mavek87 mavek87 changed the title Disable field Disable field or group May 5, 2022
@VirtualTim
Copy link
Contributor

You can attach a listener to a BooleanProperty that makes a Field editable. But of course you need to capture the Field (as in com.dlsc.formsfx.model.structure.Field) first if you're not doing that already.
You can then do something like (kotlin):

fun bindEditable(test: BooleanProperty) {
	field.editable(test.property.get())	//Init the field to the value, don't wait for a change
	test.property.addListener { _, _, newValue: Boolean -> field.editable(newValue) }
}

There might be a better way using bindings, but this works for me. Hope it helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants