Is it possible to have a custom view as a `Menu` i...
# doodle
a
Is it possible to have a custom view as a
Menu
item?
n
not directly. but you can change the way items render using a custom
MenuBehavior
. take a look at how this is done in BasicMenuBehavior.
i’m curious about your use case by the way. to see if it’s something that might make sense to support.
a
I want to have some controls in the menu, like a dropdown or a text field. It's not a traditional menu, but I don't want to have a whole separate popup just to get one small bit of user input.
Is there any way to get a
PathMetrics
instance?
n
you can inject it after adding a Module with a binding line this
Copy code
Module(name = "App Module") {
    //…
    bind<PathMetrics> () with singleton {
        PathMetricsImpl(instance())
    }
    //…
}
i thought about this use case for
Menu
but opted to ship and see how common it was. sounds like it might be worth considering.
a
It looks like
BasicMenuBehavior
requires a
PathMetrics
instance, but no modules provide a binding for it. Is that expected behavior?
I also discovered this
println
in
BasicMenuBehavior
here, which looks like maybe old logging information? I could make an issue for it but it seems like a really easy fix.
n
the module dependency is a known limitation. it stems from the fact that there are multiple
PathMetrics
impls depending on which platform you’re using. so the
Themes
library, which is
common
cannot include the binding and must rely on the app to chose. this is something that might need better documentation though. i think i’ve already discovered and fixed the old
println
for the next release. but thanks for raising it.