New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for drawable in SelectBox #7340
Comments
I just tried implement a poor workaround and it works well in my project😄. I just create new class extended from SelectBox and SelectBoxScrollPane classes and override some functions to hack it to make it support drawable. I hope my workaround can help someone else who has same issue or give someone a hint to add a new PR either by me or you to support this feature. Here are my code in Kotlin.
Here is the code how to use it.
|
That sounds familiar. One of the required overridables was broken not too long ago, so I remember trying that with nice long reflection orgies. But yes, that goes some way. The toString limitation is sidestepped not solved, but that's how it is. But you won't get a dropdown that supports entries of varying height - better rewrite from scratch in that case. Unciv has an entirely different kludge to allow somewhat appealing SelectBoxes (though mostly unused) without any subclassing - render actors as glyphs into the bitmap font... |
Issue details
Whe I use SelectBox, I see SelectBox support generic type which make me surprise that I can use some drawables or images in SelectBox. However when I dig it deeply, I found SelectBox only support textual elements, any other class from generic type will be converted to String in List class. I want to implement a SelectBox which can select different color NinePatchDrawable, but SelectBox can't make it. Maybe there is no need to support generic type in SelectBox, because SelectBox can only show textual elements. Any thoughts about add more support for SelectBox since it already support Generic type.
Reproduction steps/code
Version of libGDX and/or relevant dependencies
1.12.0
Stacktrace
//Please provide the stacktrace if applicable
Please select the affected platforms
The text was updated successfully, but these errors were encountered: