Skip to content

Commit

Permalink
Inline TextField.addOnChangeListener()
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 5, 2018
1 parent a30ba27 commit 24f23c2
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions libui-ktx/src/main/kotlin/widgets.kt
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,8 @@ open class TextField internal constructor(alloc: CPointer<uiEntry>?, val modelEn
constructor(modelEntry: ModelEntry<String>): this(uiNewEntry(), modelEntry) {
this.value = modelEntry.get()
modelEntry.addListener({newValue -> this.value = newValue})
addOnChangeListener()
}

private fun addOnChangeListener() {
uiEntryOnChanged(ptr, staticCFunction { _, ref -> with(ref.to<TextField>()) {
modelEntry.update(this.value)
this.modelEntry.update(this.value)
}}, ref.asCPointer())
}

Expand Down

0 comments on commit 24f23c2

Please sign in to comment.