B4J Library CustomComboBox (Class) (Update: 2014/7/12)

jmon

Well-Known Member
Licensed User
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.basic4ppc.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.
Capture5.PNG


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:

jmon

Well-Known Member
Licensed User
I've updated the class and fixed the problem mentioned above. Thanks Erel for the solution in this thread: http://www.basic4ppc.com/android/fo...he-screen-coords-of-a-node.42754/#post-259057

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 method: SelectedItem, Clear, visible and ItemCount
- Other minor tweaks.
The first post has been updated.
 
Last edited:

jmon

Well-Known Member
Licensed User
I've just release another new version:

- Fixed the Custom combo that wasn't anchored to the parent anchorpane
The file in first post has been updated.
 

matek

Member
Licensed User
Hello
I like your library.I would like to use in my project but I do not know how to position customcombobox. I would like to one side to have two combobox. How to add "Untitled tab"?
 

jmon

Well-Known Member
Licensed User
Hello
I like your library.I would like to use in my project but I do not know how to position customcombobox. I would like to one side to have two combobox. How to add "Untitled tab"?
You can use the visual designer to create your tabs, and add tabs. Then add an AnchorPane that will be used for the CustomCombo Box.
 
Top