- Timestamp:
- Nov 9, 2009, 3:56:17 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/plugins/org.eclipse.swt/Eclipse SWT/pm/org/eclipse/swt/widgets/Combo.java
r206 r224 430 430 if (length != OS.LIT_ERROR) { 431 431 PSZ buffer = new PSZ(length+1); 432 int result = OS.WinSendMsg (handle, OS.LM_QUERYITEMTEXT, OS.MPFROM2SHORT((short) length,(short)index), buffer);432 int result = OS.WinSendMsg (handle, OS.LM_QUERYITEMTEXT, OS.MPFROM2SHORT((short)index,(short)length), buffer); 433 433 if (result != 0) return buffer.toString (); 434 434 } … … 579 579 public String getText () { 580 580 checkWidget (); 581 int length = OS.WinQueryWindowTextLength (handle); 581 int index = OS.WinSendMsg (handle, OS.LM_QUERYSELECTION, (short)OS.LIT_CURSOR, 0); 582 int length = OS.WinSendMsg (handle, OS.LM_QUERYITEMTEXTLENGTH, (short)index, 0); 582 583 if (length == 0) return ""; 583 584 PSZ buffer = new PSZ(length); 584 OS.Win QueryWindowText (handle, length + 1, buffer);585 OS.WinSendMsg (handle, OS.LM_QUERYITEMTEXT, OS.MPFROM2SHORT((short)index,(short)length), buffer); 585 586 return buffer.toString (); 586 587 } … … 709 710 } 710 711 711 ///* Use LM_SEARCHSTRING to search for the item */712 /* Use LM_SEARCHSTRING to search for the item */ 712 713 int count = OS.WinSendMsg (handle, OS.LM_QUERYITEMCOUNT, 0, 0); 713 714 if (!((0 <= start) && (start < count))) return -1; 714 int index = 0;715 int index = start - 1; 715 716 PSZ buffer = new PSZ(string); 716 index = OS.WinSendMsg (handle, OS.LM_SEARCHSTRING, OS.MPFROM2SHORT((short)OS.LSS_CASESENSITIVE,(short)( start)), buffer);717 index = OS.WinSendMsg (handle, OS.LM_SEARCHSTRING, OS.MPFROM2SHORT((short)OS.LSS_CASESENSITIVE,(short)(index)), buffer); 717 718 if (index == OS.LIT_ERROR || index < start) return -1; 718 719 return index; … … 811 812 if (length == OS.LIT_ERROR) break; 812 813 buffer = new PSZ (length + 1); 813 int result = OS.WinSendMsg (handle, OS.LM_QUERYITEMTEXT, OS.MPFROM2SHORT((short) length,(short)start), buffer);814 int result = OS.WinSendMsg (handle, OS.LM_QUERYITEMTEXT, OS.MPFROM2SHORT((short)start,(short)length), buffer); 814 815 if (result <= 0) break; 815 816 } … … 939 940 checkWidget (); 940 941 if (index == -1) return; 941 int rc = OS.WinSendMsg (handle, OS.LM_SELECTITEM, (short)index, OS.TRUE); 942 if(rc != OS.FALSE) 943 sendEvent (SWT.Modify); 942 int count = OS.WinSendMsg (handle, OS.LM_QUERYITEMCOUNT, 0, 0); 943 if(0 <= index && index < count){ 944 int selection = OS.WinSendMsg (handle, OS.LM_QUERYSELECTION, (short)OS.LIT_CURSOR, 0); 945 int rc = OS.WinSendMsg (handle, OS.LM_SELECTITEM, (short)index, OS.TRUE); 946 if(rc != OS.FALSE && rc != selection) 947 sendEvent (SWT.Modify); 948 } 944 949 } 945 950
Note:
See TracChangeset
for help on using the changeset viewer.