|
24 | 24 | import org.eclipse.swt.internal.RunnableCompatibility; |
25 | 25 | import org.eclipse.swt.internal.browser.OS; |
26 | 26 | import org.eclipse.swt.internal.browser.Popup; |
| 27 | +import org.eclipse.swt.internal.dnd.HTMLEventWrapper; |
27 | 28 | import org.eclipse.swt.internal.xhtml.Element; |
28 | 29 | import org.eclipse.swt.internal.xhtml.HTMLEvent; |
29 | 30 | import org.eclipse.swt.internal.xhtml.Option; |
@@ -567,7 +568,11 @@ protected void createHandle () { |
567 | 568 | textInput.className = "combo-input-box"; |
568 | 569 | textInput.readOnly = (style & SWT.READ_ONLY)!=0; |
569 | 570 | //textInput.size = Combo.LIMIT; |
570 | | - handle.appendChild(textInput); |
| 571 | + Element wrapper = document.createElement("DIV"); |
| 572 | + wrapper.style.overflow = "auto"; |
| 573 | + handle.appendChild(wrapper); |
| 574 | + wrapper.appendChild(textInput); |
| 575 | + //handle.appendChild(textInput); |
571 | 576 |
|
572 | 577 | //int height = OS.getContainerHeight(dropDownButton); |
573 | 578 |
|
@@ -653,13 +658,18 @@ public void run() { |
653 | 658 | hide(); |
654 | 659 | } |
655 | 660 | }; |
656 | | -// selectInput.onmousedown = new RunnableCompatibility() { |
657 | | -// public void run() { |
658 | | -// System.out.println("select mouse down!"); |
659 | | -// updateSelection(); |
660 | | -// hide(); |
661 | | -// } |
662 | | -// }; |
| 661 | + selectInput.onmouseup = new RunnableCompatibility() { |
| 662 | + public void run() { |
| 663 | + noSelection = false; |
| 664 | + updateSelection(); |
| 665 | + if(!isSimple && itemCount > 0) { |
| 666 | + Element el = new HTMLEventWrapper(getEvent()).target; |
| 667 | + if (el != null && el.nodeName == "OPTION") { |
| 668 | + hide(); |
| 669 | + } |
| 670 | + } |
| 671 | + } |
| 672 | + }; |
663 | 673 | } |
664 | 674 | void hide(){ |
665 | 675 | if(!this.selectShown){ |
@@ -734,8 +744,10 @@ void show(){ |
734 | 744 | } |
735 | 745 |
|
736 | 746 | void updateSelection(){ |
737 | | - textInput.value = selectInput.options[getSelectionIndex()].value; |
738 | | - setText(getItem(getSelectionIndex())); |
| 747 | + int i = getSelectionIndex(); |
| 748 | + if (i < 0) return; |
| 749 | + textInput.value = selectInput.options[i].value; |
| 750 | + setText(getItem(i)); |
739 | 751 | sendEvent(SWT.Selection); |
740 | 752 | } |
741 | 753 |
|
|
0 commit comments