From 19906e0305e054c1d951705335a61d41949565f4 Mon Sep 17 00:00:00 2001 From: Robert Jaros Date: Thu, 8 Mar 2018 11:28:01 +0100 Subject: Add focus() and blur() methods to all FormControls. --- .../kotlin/pl/treksoft/kvision/form/spinner/Spinner.kt | 8 ++++++++ .../pl/treksoft/kvision/form/spinner/SpinnerInput.kt | 14 ++++++++++++++ 2 files changed, 22 insertions(+) (limited to 'src/main/kotlin/pl/treksoft/kvision/form/spinner') diff --git a/src/main/kotlin/pl/treksoft/kvision/form/spinner/Spinner.kt b/src/main/kotlin/pl/treksoft/kvision/form/spinner/Spinner.kt index c96bae26..0aa514b7 100644 --- a/src/main/kotlin/pl/treksoft/kvision/form/spinner/Spinner.kt +++ b/src/main/kotlin/pl/treksoft/kvision/form/spinner/Spinner.kt @@ -236,6 +236,14 @@ open class Spinner( return this } + override fun focus() { + input.focus() + } + + override fun blur() { + input.blur() + } + companion object { internal var counter = 0 diff --git a/src/main/kotlin/pl/treksoft/kvision/form/spinner/SpinnerInput.kt b/src/main/kotlin/pl/treksoft/kvision/form/spinner/SpinnerInput.kt index a0da7999..b9903ff8 100644 --- a/src/main/kotlin/pl/treksoft/kvision/form/spinner/SpinnerInput.kt +++ b/src/main/kotlin/pl/treksoft/kvision/form/spinner/SpinnerInput.kt @@ -281,6 +281,20 @@ open class SpinnerInput( } } + /** + * Makes the input element focused. + */ + open fun focus() { + getElementJQuery()?.focus() + } + + /** + * Makes the input element blur. + */ + open fun blur() { + getElementJQuery()?.blur() + } + companion object { internal var counter = 0 -- cgit