public void open(string combo_name, Dictionary <int, string> select_options, Rect anchor, float height, KerbalXWindow parent_win, ComboResponse selection_callback) { if (active_anchor != combo_name) { active_anchor = combo_name; sel_options = select_options; response = selection_callback; anchor_rect = anchor; parent_window = parent_win; list_height = height; } }
//Uses the ComboBox class to setup a drop down menu. protected void combobox(string combo_name, Dictionary <int, string> select_options, int selected_id, float list_width, float list_height, KerbalXWindow win, ComboResponse resp) { section(list_width, w => { float h = 22f + select_options.Count * 17; if (h > list_height) { h = list_height; } if (GUILayout.Button(select_options[selected_id], GUI.skin.textField, width(w - 20f))) { gameObject.AddOrGetComponent <ComboBox>().open(combo_name, select_options, anchors[combo_name], h, win, resp); } track_rect(combo_name, GUILayoutUtility.GetLastRect()); if (GUILayout.Button("\\/", width(20f))) { gameObject.AddOrGetComponent <ComboBox>().open(combo_name, select_options, anchors[combo_name], h, win, resp); } }); }