|
24 | 24 | import org.slf4j.Logger; |
25 | 25 | import org.slf4j.LoggerFactory; |
26 | 26 |
|
| 27 | +import com.sun.javafx.scene.control.skin.ComboBoxListViewSkin; |
| 28 | + |
27 | 29 | import de.doubleslash.keeptime.common.ColorHelper; |
28 | 30 | import de.doubleslash.keeptime.common.StyleUtils; |
29 | 31 | import de.doubleslash.keeptime.model.Model; |
|
38 | 40 | import javafx.scene.control.ComboBox; |
39 | 41 | import javafx.scene.control.DatePicker; |
40 | 42 | import javafx.scene.control.ListCell; |
| 43 | +import javafx.scene.control.ListView; |
41 | 44 | import javafx.scene.control.Spinner; |
42 | 45 | import javafx.scene.control.SpinnerValueFactory; |
43 | 46 | import javafx.scene.control.TextArea; |
| 47 | +import javafx.scene.input.KeyCode; |
| 48 | +import javafx.scene.input.KeyEvent; |
44 | 49 | import javafx.scene.layout.GridPane; |
45 | 50 | import javafx.scene.paint.Color; |
46 | 51 | import javafx.util.StringConverter; |
@@ -240,6 +245,19 @@ public void changed(final ObservableValue<? extends String> observable, final St |
240 | 245 |
|
241 | 246 | }); |
242 | 247 |
|
| 248 | + // strg+a Behaviour bug hack |
| 249 | + // https://stackoverflow.com/questions/51943654/javafx-combobox-make-control-a-select-all-in-text-box-while-dropdown-is-visi |
| 250 | + projectComboBox.setOnShown(e -> { |
| 251 | + final ComboBoxListViewSkin<?> skin = (ComboBoxListViewSkin<?>) projectComboBox.getSkin(); |
| 252 | + final ListView<?> list = (ListView<?>) skin.getPopupContent(); |
| 253 | + list.addEventFilter(KeyEvent.KEY_PRESSED, keyEvent -> { |
| 254 | + if (keyEvent.isControlDown() && keyEvent.getCode() == KeyCode.A) { |
| 255 | + projectComboBox.getEditor().selectAll(); |
| 256 | + } |
| 257 | + }); |
| 258 | + projectComboBox.setOnShown(null); |
| 259 | + }); |
| 260 | + |
243 | 261 | } |
244 | 262 |
|
245 | 263 | public void initializeWith(final Work work) { |
|
0 commit comments