File tree Expand file tree Collapse file tree 1 file changed +20
-7
lines changed
sources/net.sf.j2s.java.org.eclipse.swt/src/org/eclipse/swt/widgets Expand file tree Collapse file tree 1 file changed +20
-7
lines changed Original file line number Diff line number Diff line change @@ -609,31 +609,44 @@ public void run(){
609
609
if (items .length == 0 ) {
610
610
return ;
611
611
}
612
+ if (e .keyCode == 38 || e .keyCode == 40 ) {
613
+ String text = getText ();
614
+ currentIndex = -1 ;
615
+ for (int i = 0 ; i < items .length ; i ++) {
616
+ if (text .equals (items [i ])) {
617
+ currentIndex = i ;
618
+ break ;
619
+ }
620
+ }
621
+ if (currentIndex < 0 ) {
622
+ currentIndex = selectInput .selectedIndex ;
623
+ }
624
+ }
612
625
switch (e .keyCode ){
613
626
case 38 :
614
- selectInput .selectedIndex = currentIndex ;
615
- noSelection = false ;
616
- updateSelection ();
617
- noSelection = true ;
618
627
if (currentIndex > 0 ) {
619
628
currentIndex --;
620
629
}
621
630
if (currentIndex >= items .length ) {
622
631
currentIndex = items .length - 1 ;
623
632
}
624
- toReturn (false );
625
- break ;
626
- case 40 :
627
633
selectInput .selectedIndex = currentIndex ;
628
634
noSelection = false ;
629
635
updateSelection ();
630
636
noSelection = true ;
637
+ toReturn (false );
638
+ break ;
639
+ case 40 :
631
640
if (currentIndex < items .length ) {
632
641
currentIndex ++;
633
642
}
634
643
if (currentIndex >= items .length ) {
635
644
currentIndex = items .length - 1 ;
636
645
}
646
+ selectInput .selectedIndex = currentIndex ;
647
+ noSelection = false ;
648
+ updateSelection ();
649
+ noSelection = true ;
637
650
toReturn (false );
638
651
break ;
639
652
}
You can’t perform that action at this time.
0 commit comments