From 30dcb33b93ab5126959e1a7e10be3a9917baceff Mon Sep 17 00:00:00 2001 From: Francesco Galgani Date: Fri, 29 May 2026 15:24:09 +0200 Subject: [PATCH] Defer lightweight picker traversal editing --- .../src/com/codename1/ui/spinner/Picker.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/CodenameOne/src/com/codename1/ui/spinner/Picker.java b/CodenameOne/src/com/codename1/ui/spinner/Picker.java index 8965303f60..f11017710c 100644 --- a/CodenameOne/src/com/codename1/ui/spinner/Picker.java +++ b/CodenameOne/src/com/codename1/ui/spinner/Picker.java @@ -596,7 +596,6 @@ private void endEditing(int command, InteractionDialog dlg, InternalPickerWidget currentSpinner = null; } restoreContentPane(); - dlg.disposeToTheBottom(); if (command == COMMAND_CANCEL) { // Roll back any setX calls made while the popup was showing // (e.g. a custom "+7 days" button) so getDate() returns the @@ -609,6 +608,7 @@ private void endEditing(int command, InteractionDialog dlg, InternalPickerWidget preEditValue = null; preEditDateValueExplicitlySet = false; updateValue(); + dlg.disposeToTheBottom(); } else { preEditValue = null; preEditDateValueExplicitlySet = false; @@ -629,9 +629,17 @@ private void endEditing(int command, InteractionDialog dlg, InternalPickerWidget next = f.getPreviousComponent(Picker.this); } } - if (next != null) { - next.requestFocus(); - next.startEditingAsync(); + final Component nextToEdit = next; + if (nextToEdit != null) { + dlg.disposeToTheBottom(new Runnable() { + @Override + public void run() { + nextToEdit.requestFocus(); + nextToEdit.startEditingAsync(); + } + }); + } else { + dlg.disposeToTheBottom(); } } }