kvision / pl.treksoft.kvision.form.upload / Upload / setEventListener

setEventListener

open fun <T : Widget> setEventListener(block: SnOn<T>.() -> Unit): Widget

Overrides Widget.setEventListener

Sets an event listener for current widget, keeping the actual type of component.

Parameters

T - widget type

block - event handler

Return

current widget

Example:

    button.setEventListener<Button> {
        dblclick = {
            Alert.show("Button double clicked!")
            // self is of type Button here
        }
    }

open fun setEventListener(block: SnOn<Widget>.() -> Unit): Widget

Overrides Widget.setEventListener

Sets an event listener for current widget.

Parameters

block - event handler

Return

current widget

Example:

    button.setEventListener {
        dblclick = {
            Alert.show("Button double clicked!")
            // self is of type Widget here
        }
    }