Jörg Rade
12/09/2021, 11:25 AMdropDown(tr("Dropdown with custom list"), icon = "far fa-image", style = ButtonStyle.WARNING) {
minWidth = 250.px
image(require("img/cat.jpg")) { height = 170.px; margin = 10.px; title = "Cat" }
separator()
image(require("img/dog.jpg")) { height = 170.px; margin = 10.px; title = "Dog" }
}
suggests I can have either a FontAwesome icon plus text or an image.
What I want is a custom image with text.Robert Jaros
12/09/2021, 11:35 AMJörg Rade
12/09/2021, 11:39 AMJörg Rade
12/09/2021, 11:48 AMRobert Jaros
12/09/2021, 12:54 PMDropDown
component just use image
property (it's there, it's just not exposed in the constructor)Jörg Rade
12/09/2021, 1:03 PMJörg Rade
12/09/2021, 1:20 PMfun insertConnection() {
mainEntry.separator()
val resString = io.kvision.require("img/gift_48.png")
val menuEntry = buildMenuEntryWithImage("Connection 1", image = resString, { LoginPrompt().open() })
mainEntry.add(menuEntry)
}
private fun buildMenuEntryWithImage(label: String, image: ResString?, action: dynamic): Link {
val link = Link(label, image = image, className = "dropdown-item")
link.onClick { e ->
val at = Point(e.pageX.toInt(), e.pageY.toInt())
UiManager.position = at
action()
}
return link
}
Can I scale the image (ResString) down?Robert Jaros
12/09/2021, 1:22 PMJörg Rade
12/09/2021, 1:23 PMJörg Rade
12/09/2021, 1:23 PMRobert Jaros
12/09/2021, 1:24 PMJörg Rade
12/09/2021, 1:24 PMJörg Rade
12/09/2021, 1:27 PMval resString = io.kvision.require("img/gift_48.png") {style}
Jörg Rade
12/09/2021, 1:28 PMRobert Jaros
12/09/2021, 1:30 PMval myStyle = style(".dropdown-item") {
style("img") {
width = 20.px
height = 20.px
}
}
Jörg Rade
12/09/2021, 1:33 PMJörg Rade
12/09/2021, 1:34 PMval resString = require("img/gift_48.png")
resString { addCssClass("app-icon") }
Jörg Rade
12/09/2021, 1:37 PM