Hi,
There is a problem with the combobox in Javafx, is that it's difficult to customize it with B4J. Basically, if you want to set anything apart from a string, you will encounter problems as I have in this thread: http://www.b4x.com/android/forum/threads/combobox-how-to-insert-nodes-with-cell-factory.42546/
So this class is my answer to this problem. In my case, I just needed to show an image with a text. It's a class, and I give the source, so you can customize it to your needs or learn from it.
If you modify the class, I'd be happy to see your modifications.
Enjoy.
[EDIT]
I've updated the class. The file has been replaced.
[EDIT 2]
There is a problem with the combobox in Javafx, is that it's difficult to customize it with B4J. Basically, if you want to set anything apart from a string, you will encounter problems as I have in this thread: http://www.b4x.com/android/forum/threads/combobox-how-to-insert-nodes-with-cell-factory.42546/
So this class is my answer to this problem. In my case, I just needed to show an image with a text. It's a class, and I give the source, so you can customize it to your needs or learn from it.
If you modify the class, I'd be happy to see your modifications.
Enjoy.
[EDIT]
I've updated the class. The file has been replaced.
New:
- Try to mimic the style of the combobox better.
- Default styles set to "combo-box" and "combo-box-base".
- If no image is set, an arrow down will be set (This character:"▼")
- Child window is now correctly positioned if the panel is child of another node (Thanks Erel for that).
- Method "DropDown" returns the form for the drop down, so you can use it to apply css.
- New methods: SelectedItem, Clear, visible and ItemCount
- Other minor tweaks.
[EDIT 2]
- Fixed the Custom combo that wasn't anchored to the parent anchorpane
Attachments
Last edited: