123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- = combobox
- :author:
- :revnumber:
- :revdate: 2016/03/17 20:48
- :relfileprefix: ../../../
- :imagesdir: ../../..
- ifdef::env-github,env-browser[:outfilesuffix: .adoc]
- == SelectBox & ComboBox
- The combo box and select box works exactly like any other combo box or select box:
- * They both provides the standard 3 constructors
- * The only difference between the two is the SelectBox’s text field is disabled.
- * The SelectBox still allows for arrow key navigation and enter select, though other key input is disabled.
- === Usage is as follows:
- [source,java]
- ----
- ComboBox combo = new ComboBox(
- screen,
- “SomeID”,
- new Vector2f(5,5)
- );
- combo.addListItem(“Some caption”, “Some value”);
- combo.addListItem(“Some caption”, “Some value”);
- combo.addListItem(“Some caption”, “Some value”);
- combo.addListItem(“Some caption”, “Some value”);
- combo.addListItem(“Some caption”, “Some value”);
- combo.addListItem(“Some caption”, “Some value”);
- ----
- === Abstract Event Methods:
- [source,java]
- ----
- public void onChange(int selectedIndex, String value);
- ----
- === Hooks:
- [source,java]
- ----
- // Overridable hook for keyboard input events
- public void controlKeyPressHook(KeyInputEvent evt, String text) { }
- ----
- === Set Selected Index via Code
- [source,java]
- ----
- combo.setSelectedIndex(int index);
- combo.getSelectedIndex();
- ----
- === Methods specific to Combo & Select Boxes:
- [source,java]
- ----
- // Add a list item
- combo.addListItem(String caption, String value);
- // Insert a list item
- combo.insertListItem(int index, String caption, Object value);
- // Remove a list item
- combo.removeListItem(int index);
- combo.removeListItem(String caption);
- combo.removeListIten(Object value);
- // Sorting methods
- combo.sortList(); // Sorts drop-down list standard alpha-numeric
- combo.sortListNumeric(); // Sorts drop-down list true numeric
- // Drop-down list validation
- combo.validateListSize(); //returns false if null or size 0, else returns true;
- // Force drop-down list to hide
- combo.hideDropDownList();
- // Retrieve List Items
- combo.getSelectedListItem();
- combo.getListItemByIndex(int index);
- ----
|