Skip to content

Commit

Permalink
Use a sensible default value for textfield.modelEntry
Browse files Browse the repository at this point in the history
Refer to issue: msink#8

Co-authored-by: Mervyn McCreight <[email protected]>
  • Loading branch information
andreas-mausch and mervyn-mccreight committed Nov 6, 2018
1 parent 24f23c2 commit b06d69b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions libui-ktx/src/main/kotlin/widgets.kt
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ import platform.posix.*

/** DSL builder for a simple single line text entry widget. */
inline fun Container.textfield(
readonly: Boolean = false,
modelEntry: ModelEntry<String>? = null,
init: TextField.() -> Unit = {}
): TextField = add(TextField(modelEntry ?: ModelEntry(""))
readonly: Boolean = false,
modelEntry: ModelEntry<String> = ModelEntry(""),
init: TextField.() -> Unit = {}
): TextField = add(TextField(modelEntry)
.apply { if (readonly) this.readonly = readonly }
.apply(init))

Expand Down

0 comments on commit b06d69b

Please sign in to comment.