IDEMPIERE-6146 Recently access menu item: minor refresh refinement (#2370)

* IDEMPIERE-6146 Recently access menu item: minor refresh refinement

* IDEMPIERE-6146 Recently access menu item: minor refresh refinement

- Fix handling of "enter" key
This commit is contained in:
hengsin 2024-05-18 20:51:28 +08:00 committed by Carlos Ruiz
parent 66819ecf79
commit 62c86f82c3
1 changed files with 6 additions and 3 deletions

View File

@ -668,7 +668,8 @@ public class MenuSearchController implements EventListener<Event>{
int count = listbox.getItemCount(); int count = listbox.getItemCount();
for(int i = 0; i < count; i++) { for(int i = 0; i < count; i++) {
ListItem item = listbox.getItemAtIndex(i); ListItem item = listbox.getItemAtIndex(i);
String label = item.getLabel(); MenuItem menuItem = item.getValue();
String label = menuItem.getLabel();
if (Util.isEmpty(label)) continue; if (Util.isEmpty(label)) continue;
if (label.equalsIgnoreCase(text)) { if (label.equalsIgnoreCase(text)) {
exact = item; exact = item;
@ -678,11 +679,13 @@ public class MenuSearchController implements EventListener<Event>{
} }
} }
if (exact != null) { if (exact != null) {
textbox.setText(exact.getLabel()); MenuItem menuItem = exact.getValue();
textbox.setText(menuItem.getLabel());
onSelect(exact, false); onSelect(exact, false);
return true; return true;
} else if (firstStart != null) { } else if (firstStart != null) {
textbox.setText(firstStart.getLabel()); MenuItem menuItem = firstStart.getValue();
textbox.setText(menuItem.getLabel());
onSelect(firstStart, false); onSelect(firstStart, false);
return true; return true;
} }