setEventListener

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

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

Return

id of the handler

Example:

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

Parameters

T

widget type

block

event handler