Skip to content
This repository has been archived by the owner on Sep 28, 2024. It is now read-only.

Commit

Permalink
togglegroup() builder accepts property parameter (#956)
Browse files Browse the repository at this point in the history
  • Loading branch information
Edvin Syse committed Mar 22, 2019
1 parent 7cadc7d commit 0550cac
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
- Added `cubiccurveTo` builder (/~https://github.com/edvin/tornadofx/issues/911)
- onLeftClick() and onRightClick()
- Convenience function builders for SimpleXXXProperty classes (/~https://github.com/edvin/tornadofx/pull/935)
- `togglegroup()` builder accepts property parameter (/~https://github.com/edvin/tornadofx/issues/956)

## [1.7.18]

Expand Down
7 changes: 4 additions & 3 deletions src/main/java/tornadofx/Controls.kt
Original file line number Diff line number Diff line change
Expand Up @@ -237,9 +237,10 @@ fun ButtonBar.button(text: ObservableValue<String>, type: ButtonBar.ButtonData?
op(it)
}

fun Node.togglegroup(op: ToggleGroup.() -> Unit = {}) = ToggleGroup().also {
properties["tornadofx.togglegroup"] = it
op(it)
fun <T> Node.togglegroup(property: ObservableValue<T>? = null, op: ToggleGroup.() -> Unit = {}) = ToggleGroup().also {tg ->
properties["tornadofx.togglegroup"] = tg
property?.let { tg.bind(it) }
op(tg)
}

/**
Expand Down

0 comments on commit 0550cac

Please sign in to comment.