https://kotlinlang.org logo
Title
j

jeff

12/19/2020, 5:01 AM
Once I've set up a click listener with e.g.
myView.onClick { ... }
is there a way to clear/remove that listener? Couldn't find anything in the documentation...
r

RezMike

12/19/2020, 5:04 AM
I don't think it's possible with
onClick { ... }
, you should check
Component
classes instead
j

jeff

12/19/2020, 5:08 AM
Ok cool. Thanks!
So I dug into components a bit. I found
MouseComponent
but it doesn't appear to be nearly as full-featured as the extensions on View. For example,
override fun onMouseEvent(views: Views, event: MouseEvent) {
        when {
            event.typeClick -> {
                // triggers whether or not mouse is inside view's bounds
                println("CLICKED!")
            }
            event.typeEnter -> {
                // never triggers?
                println("ENTER")
            }
        }
    }
I feel like I'm fighting the engine here, which probably means I'm doing something wrong...
r

RezMike

12/21/2020, 3:07 AM
you should check the implementation of the extensions, I can't help you here
j

jeff

12/21/2020, 3:26 AM
No worries. I did look at how they're implemented. I have something that's working for me, I just wanted to make sure I wasn't missing something obvious since it seemed like a weird disconnect. :thank-you: