Tornadofx: Button with graphic in toolbar bug

Created on 13 Oct 2017  路  3Comments  路  Source: edvin/tornadofx

I have a toolbar containing a button that has a graphic, its output seems like a bug. Here's my code:

toolbar {
    button("", imageview("images/48x48/upm.png"))
}

However if I were place the button say within a pane, it shows up like this.

Most helpful comment

The reason is that you're calling an imageview builder on the toolbar, thus creating and adding the ImageView to the toolbar instead :) Avoid using the imageview builder as a parameter to the button builder, and instead simply instantiate it normally: ImageView(params).

I know this might seem confusing at first, and I would love to plug this hole so that this wouldn't be possible, but I can't think of a way we can avoid this, as imageview is available as a builder as long as you're inside any Node.

Once you're aware of this and understands the issue it should be easy to avoid in the future though :) Does that make sense?

All 3 comments

The reason is that you're calling an imageview builder on the toolbar, thus creating and adding the ImageView to the toolbar instead :) Avoid using the imageview builder as a parameter to the button builder, and instead simply instantiate it normally: ImageView(params).

I know this might seem confusing at first, and I would love to plug this hole so that this wouldn't be possible, but I can't think of a way we can avoid this, as imageview is available as a builder as long as you're inside any Node.

Once you're aware of this and understands the issue it should be easy to avoid in the future though :) Does that make sense?

@edvin Ah I see, makes sense now. Thanks for your support!

My pleasure :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

MairwunNx picture MairwunNx  路  3Comments

Bastercall picture Bastercall  路  3Comments

eibens picture eibens  路  4Comments

vlipovetskii picture vlipovetskii  路  6Comments

ThraaxSession picture ThraaxSession  路  3Comments