Mercurial > projects > dwt-win
comparison dwt/widgets/Combo.d @ 213:36f5cb12e1a2
Update to SWT 3.4M7
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sat, 17 May 2008 17:34:28 +0200 |
parents | ab60f3309436 |
children | a8fed3e56433 |
comparison
equal
deleted
inserted
replaced
212:ab60f3309436 | 213:36f5cb12e1a2 |
---|---|
76 alias Composite.setBackgroundImage setBackgroundImage; | 76 alias Composite.setBackgroundImage setBackgroundImage; |
77 alias Composite.setBounds setBounds; | 77 alias Composite.setBounds setBounds; |
78 alias Composite.setToolTipText setToolTipText; | 78 alias Composite.setToolTipText setToolTipText; |
79 | 79 |
80 private static Combo pThis; | 80 private static Combo pThis; |
81 bool noSelection, ignoreDefaultSelection, ignoreCharacter, ignoreModify; | 81 bool noSelection, ignoreDefaultSelection, ignoreCharacter, ignoreModify, ignoreResize; |
82 HHOOK cbtHook; | 82 HHOOK cbtHook; |
83 int scrollWidth, visibleCount = 5; | 83 int scrollWidth, visibleCount = 5; |
84 | 84 |
85 /** | 85 /** |
86 * the operating system limit for the number of characters | 86 * the operating system limit for the number of characters |
319 } | 319 } |
320 | 320 |
321 override int callWindowProc (HWND hwnd, int msg, int wParam, int lParam) { | 321 override int callWindowProc (HWND hwnd, int msg, int wParam, int lParam) { |
322 if (handle is null) return 0; | 322 if (handle is null) return 0; |
323 if (hwnd is handle) { | 323 if (hwnd is handle) { |
324 switch (msg) { | |
325 case OS.WM_SIZE: { | |
326 ignoreResize = true; | |
327 int /*long*/ result = OS.CallWindowProc (ComboProc, hwnd, msg, wParam, lParam); | |
328 ignoreResize = false; | |
329 return result; | |
330 } | |
331 } | |
324 return OS.CallWindowProc( ComboProc, hwnd, msg, wParam, lParam); | 332 return OS.CallWindowProc( ComboProc, hwnd, msg, wParam, lParam); |
325 } | 333 } |
326 auto hwndText = OS.GetDlgItem (handle, CBID_EDIT); | 334 auto hwndText = OS.GetDlgItem (handle, CBID_EDIT); |
327 if (hwnd is hwndText) { | 335 if (hwnd is hwndText) { |
328 return OS.CallWindowProc( EditProc, hwnd, msg, wParam, lParam); | 336 return OS.CallWindowProc( EditProc, hwnd, msg, wParam, lParam); |
460 if ((style & DWT.READ_ONLY) !is 0) { | 468 if ((style & DWT.READ_ONLY) !is 0) { |
461 width += 8; | 469 width += 8; |
462 } else { | 470 } else { |
463 auto hwndText = OS.GetDlgItem (handle, CBID_EDIT); | 471 auto hwndText = OS.GetDlgItem (handle, CBID_EDIT); |
464 if (hwndText !is null) { | 472 if (hwndText !is null) { |
465 int margins = OS.SendMessage (hwndText, OS.EM_GETMARGINS, 0, 0); | 473 int /*long*/ margins = OS.SendMessage (hwndText, OS.EM_GETMARGINS, 0, 0); |
466 int marginWidth = (margins & 0xFFFF) + ((margins >> 16) & 0xFFFF); | 474 int marginWidth = OS.LOWORD (margins) + OS.HIWORD (margins); |
467 width += marginWidth + 3; | 475 width += marginWidth + 3; |
468 } | 476 } |
469 } | 477 } |
470 COMBOBOXINFO pcbi; | 478 COMBOBOXINFO pcbi; |
471 pcbi.cbSize = COMBOBOXINFO.sizeof; | 479 pcbi.cbSize = COMBOBOXINFO.sizeof; |
535 state &= ~(CANVAS | THEME_BACKGROUND); | 543 state &= ~(CANVAS | THEME_BACKGROUND); |
536 | 544 |
537 /* Get the text and list window procs */ | 545 /* Get the text and list window procs */ |
538 auto hwndText = OS.GetDlgItem (handle, CBID_EDIT); | 546 auto hwndText = OS.GetDlgItem (handle, CBID_EDIT); |
539 if (hwndText !is null && EditProc is null) { | 547 if (hwndText !is null && EditProc is null) { |
540 EditProc = cast(WNDPROC) OS.GetWindowLong (hwndText, OS.GWL_WNDPROC); | 548 EditProc = cast(WNDPROC) OS.GetWindowLongPtr (hwndText, OS.GWLP_WNDPROC); |
541 } | 549 } |
542 auto hwndList = OS.GetDlgItem (handle, CBID_LIST); | 550 auto hwndList = OS.GetDlgItem (handle, CBID_LIST); |
543 if (hwndList !is null && ListProc is null) { | 551 if (hwndList !is null && ListProc is null) { |
544 ListProc = cast(WNDPROC) OS.GetWindowLong (hwndList, OS.GWL_WNDPROC); | 552 ListProc = cast(WNDPROC) OS.GetWindowLongPtr (hwndList, OS.GWLP_WNDPROC); |
545 } | 553 } |
546 | 554 |
547 /* | 555 /* |
548 * Bug in Windows. If the combo box has the CBS_SIMPLE style, | 556 * Bug in Windows. If the combo box has the CBS_SIMPLE style, |
549 * the list portion of the combo box is not drawn correctly the | 557 * the list portion of the combo box is not drawn correctly the |
636 auto hwndText = OS.GetDlgItem (handle, CBID_EDIT); | 644 auto hwndText = OS.GetDlgItem (handle, CBID_EDIT); |
637 if (hwndText !is null) { | 645 if (hwndText !is null) { |
638 int start, end; | 646 int start, end; |
639 OS.SendMessage (handle, OS.CB_GETEDITSEL, &start, &end); | 647 OS.SendMessage (handle, OS.CB_GETEDITSEL, &start, &end); |
640 if (start !is end ) { | 648 if (start !is end ) { |
641 int lParam = (x & 0xFFFF) | ((y << 16) & 0xFFFF0000); | 649 int /*long*/ lParam = OS.MAKELPARAM (x, y); |
642 int position = OS.SendMessage (hwndText, OS.EM_CHARFROMPOS, 0, lParam) & 0xFFFF; | 650 int position = OS.LOWORD (OS.SendMessage (hwndText, OS.EM_CHARFROMPOS, 0, lParam)); |
643 if (start <= position && position < end ) { | 651 if (start <= position && position < end ) { |
644 if (super.dragDetect (hwnd, x, y, filter, detect, consume)) { | 652 if (super.dragDetect (hwnd, x, y, filter, detect, consume)) { |
645 if (consume !is null) consume [0] = true; | 653 if (consume !is null) consume [0] = true; |
646 return true; | 654 return true; |
647 } | 655 } |
757 * @exception DWTException <ul> | 765 * @exception DWTException <ul> |
758 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> | 766 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> |
759 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> | 767 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> |
760 * </ul> | 768 * </ul> |
761 * | 769 * |
762 * @since 3.3 | 770 * @since 3.4 |
763 */ | 771 */ |
764 /*public*/ bool getListVisible () { | 772 public bool getListVisible () { |
765 checkWidget (); | 773 checkWidget (); |
766 if ((style & DWT.DROP_DOWN) !is 0) { | 774 if ((style & DWT.DROP_DOWN) !is 0) { |
767 return OS.SendMessage (handle, OS.CB_GETDROPPEDSTATE, 0, 0) !is 0; | 775 return OS.SendMessage (handle, OS.CB_GETDROPPEDSTATE, 0, 0) !is 0; |
768 } | 776 } |
769 return true; | 777 return true; |
770 } | 778 } |
771 | 779 |
772 override String getNameText () { | 780 override String getNameText () { |
773 return getText (); | 781 return getText (); |
782 } | |
783 | |
784 /** | |
785 * Marks the receiver's list as visible if the argument is <code>true</code>, | |
786 * and marks it invisible otherwise. | |
787 * <p> | |
788 * If one of the receiver's ancestors is not visible or some | |
789 * other condition makes the receiver not visible, marking | |
790 * it visible may not actually cause it to be displayed. | |
791 * </p> | |
792 * | |
793 * @param visible the new visibility state | |
794 * | |
795 * @exception DWTException <ul> | |
796 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> | |
797 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> | |
798 * </ul> | |
799 * | |
800 * @since 3.4 | |
801 */ | |
802 public void setListVisible (bool visible) { | |
803 checkWidget (); | |
804 OS.SendMessage (handle, OS.CB_SHOWDROPDOWN, visible ? 1 : 0, 0); | |
774 } | 805 } |
775 | 806 |
776 /** | 807 /** |
777 * Returns the orientation of the receiver. | 808 * Returns the orientation of the receiver. |
778 * | 809 * |
1568 sendEvent (DWT.Modify); | 1599 sendEvent (DWT.Modify); |
1569 // widget could be disposed at this point | 1600 // widget could be disposed at this point |
1570 } | 1601 } |
1571 | 1602 |
1572 /** | 1603 /** |
1573 * Marks the receiver's list as visible if the argument is <code>true</code>, | |
1574 * and marks it invisible otherwise. | |
1575 * <p> | |
1576 * If one of the receiver's ancestors is not visible or some | |
1577 * other condition makes the receiver not visible, marking | |
1578 * it visible may not actually cause it to be displayed. | |
1579 * </p> | |
1580 * | |
1581 * @param visible the new visibility state | |
1582 * | |
1583 * @exception DWTException <ul> | |
1584 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> | |
1585 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> | |
1586 * </ul> | |
1587 * | |
1588 * @since 3.3 | |
1589 */ | |
1590 /*public*/ void setListVisible (bool visible) { | |
1591 checkWidget (); | |
1592 OS.SendMessage (handle, OS.CB_SHOWDROPDOWN, visible ? 1 : 0, 0); | |
1593 } | |
1594 | |
1595 /** | |
1596 * Sets the orientation of the receiver, which must be one | 1604 * Sets the orientation of the receiver, which must be one |
1597 * of the constants <code>DWT.LEFT_TO_RIGHT</code> or <code>DWT.RIGHT_TO_LEFT</code>. | 1605 * of the constants <code>DWT.LEFT_TO_RIGHT</code> or <code>DWT.RIGHT_TO_LEFT</code>. |
1598 * <p> | 1606 * <p> |
1599 * | 1607 * |
1600 * @param orientation new orientation style | 1608 * @param orientation new orientation style |
1776 int start = selection.x, end = selection.y; | 1784 int start = selection.x, end = selection.y; |
1777 if (!OS.IsUnicode && OS.IsDBLocale) { | 1785 if (!OS.IsUnicode && OS.IsDBLocale) { |
1778 start = wcsToMbcsPos (start); | 1786 start = wcsToMbcsPos (start); |
1779 end = wcsToMbcsPos (end); | 1787 end = wcsToMbcsPos (end); |
1780 } | 1788 } |
1781 int bits = (start & 0xFFFF) | ((end << 16) & 0xFFFF0000); | 1789 int /*long*/ bits = OS.MAKELPARAM (start, end); |
1782 OS.SendMessage (handle, OS.CB_SETEDITSEL, 0, bits); | 1790 OS.SendMessage (handle, OS.CB_SETEDITSEL, 0, bits); |
1783 } | 1791 } |
1784 | 1792 |
1785 /** | 1793 /** |
1786 * Sets the contents of the receiver's text field to the | 1794 * Sets the contents of the receiver's text field to the |
1812 return; | 1820 return; |
1813 } | 1821 } |
1814 int limit = LIMIT; | 1822 int limit = LIMIT; |
1815 auto hwndText = OS.GetDlgItem (handle, CBID_EDIT); | 1823 auto hwndText = OS.GetDlgItem (handle, CBID_EDIT); |
1816 if (hwndText !is null) { | 1824 if (hwndText !is null) { |
1817 limit = OS.SendMessage (hwndText, OS.EM_GETLIMITTEXT, 0, 0); | 1825 limit = OS.SendMessage (hwndText, OS.EM_GETLIMITTEXT, 0, 0) & 0x7FFFFFFF; |
1818 } | 1826 } |
1819 if (string.length > limit) string = string.substring (0, limit); | 1827 if (string.length > limit) string = string.substring (0, limit); |
1820 TCHAR* buffer = StrToTCHARz( string ); | 1828 TCHAR* buffer = StrToTCHARz( string ); |
1821 if (OS.SetWindowText (handle, buffer)) { | 1829 if (OS.SetWindowText (handle, buffer)) { |
1822 sendEvent (DWT.Modify); | 1830 sendEvent (DWT.Modify); |
1891 override void subclass () { | 1899 override void subclass () { |
1892 super.subclass (); | 1900 super.subclass (); |
1893 auto newProc = display.windowProc; | 1901 auto newProc = display.windowProc; |
1894 auto hwndText = OS.GetDlgItem (handle, CBID_EDIT); | 1902 auto hwndText = OS.GetDlgItem (handle, CBID_EDIT); |
1895 if (hwndText !is null) { | 1903 if (hwndText !is null) { |
1896 OS.SetWindowLong (hwndText, OS.GWL_WNDPROC, newProc); | 1904 OS.SetWindowLongPtr (hwndText, OS.GWLP_WNDPROC, newProc); |
1897 } | 1905 } |
1898 auto hwndList = OS.GetDlgItem (handle, CBID_LIST); | 1906 auto hwndList = OS.GetDlgItem (handle, CBID_LIST); |
1899 if (hwndList !is null) { | 1907 if (hwndList !is null) { |
1900 OS.SetWindowLong (hwndList, OS.GWL_WNDPROC, newProc); | 1908 OS.SetWindowLongPtr (hwndList, OS.GWLP_WNDPROC, newProc); |
1901 } | 1909 } |
1902 } | 1910 } |
1903 | 1911 |
1904 override bool translateTraversal (MSG* msg) { | 1912 override bool translateTraversal (MSG* msg) { |
1905 /* | 1913 /* |
1906 * When the combo box is dropped down, allow return | 1914 * When the combo box is dropped down, allow return |
1907 * to select an item in the list and escape to close | 1915 * to select an item in the list and escape to close |
1908 * the combo box. | 1916 * the combo box. |
1909 */ | 1917 */ |
1910 switch (msg.wParam) { | 1918 switch ((msg.wParam)) { |
1911 case OS.VK_RETURN: | 1919 case OS.VK_RETURN: |
1912 case OS.VK_ESCAPE: | 1920 case OS.VK_ESCAPE: |
1913 if ((style & DWT.DROP_DOWN) !is 0) { | 1921 if ((style & DWT.DROP_DOWN) !is 0) { |
1914 if (OS.SendMessage (handle, OS.CB_GETDROPPEDSTATE, 0, 0) !is 0) { | 1922 if (OS.SendMessage (handle, OS.CB_GETDROPPEDSTATE, 0, 0) !is 0) { |
1915 return false; | 1923 return false; |
1942 | 1950 |
1943 override void unsubclass () { | 1951 override void unsubclass () { |
1944 super.unsubclass (); | 1952 super.unsubclass (); |
1945 auto hwndText = OS.GetDlgItem (handle, CBID_EDIT); | 1953 auto hwndText = OS.GetDlgItem (handle, CBID_EDIT); |
1946 if (hwndText !is null && EditProc !is null) { | 1954 if (hwndText !is null && EditProc !is null) { |
1947 OS.SetWindowLong (hwndText, OS.GWL_WNDPROC, cast(int) EditProc); | 1955 OS.SetWindowLongPtr (hwndText, OS.GWLP_WNDPROC, cast(LONG_PTR)EditProc); |
1948 } | 1956 } |
1949 auto hwndList = OS.GetDlgItem (handle, CBID_LIST); | 1957 auto hwndList = OS.GetDlgItem (handle, CBID_LIST); |
1950 if (hwndList !is null && ListProc !is null) { | 1958 if (hwndList !is null && ListProc !is null) { |
1951 OS.SetWindowLong (hwndList, OS.GWL_WNDPROC, cast(int) ListProc); | 1959 OS.SetWindowLongPtr (hwndList, OS.GWLP_WNDPROC, cast(LONG_PTR)ListProc); |
1952 } | 1960 } |
1953 } | 1961 } |
1954 | 1962 |
1955 String verifyText (String string, int start, int end, Event keyEvent) { | 1963 String verifyText (String string, int start, int end, Event keyEvent) { |
1956 Event event = new Event (); | 1964 Event event = new Event (); |
2105 override LRESULT WM_CTLCOLOR (int wParam, int lParam) { | 2113 override LRESULT WM_CTLCOLOR (int wParam, int lParam) { |
2106 return wmColorChild (wParam, lParam); | 2114 return wmColorChild (wParam, lParam); |
2107 } | 2115 } |
2108 | 2116 |
2109 override LRESULT WM_GETDLGCODE (int wParam, int lParam) { | 2117 override LRESULT WM_GETDLGCODE (int wParam, int lParam) { |
2110 int code = callWindowProc (handle, OS.WM_GETDLGCODE, wParam, lParam); | 2118 int /*long*/ code = callWindowProc (handle, OS.WM_GETDLGCODE, wParam, lParam); |
2111 return new LRESULT (code | OS.DLGC_WANTARROWS); | 2119 return new LRESULT (code | OS.DLGC_WANTARROWS); |
2112 } | 2120 } |
2113 | 2121 |
2114 override LRESULT WM_KILLFOCUS (int wParam, int lParam) { | 2122 override LRESULT WM_KILLFOCUS (int wParam, int lParam) { |
2115 /* | 2123 /* |
2161 */ | 2169 */ |
2162 return null; | 2170 return null; |
2163 } | 2171 } |
2164 | 2172 |
2165 override LRESULT WM_SIZE (int wParam, int lParam) { | 2173 override LRESULT WM_SIZE (int wParam, int lParam) { |
2174 /* | |
2175 * Feature in Windows. When a combo box is resized, | |
2176 * the size of the drop down rectangle is specified | |
2177 * using the height and then the combo box resizes | |
2178 * to be the height of the text field. This causes | |
2179 * two WM_SIZE messages to be sent and two DWT.Resize | |
2180 * events to be issued. The fix is to ignore the | |
2181 * second resize. | |
2182 */ | |
2183 if (ignoreResize) return null; | |
2166 /* | 2184 /* |
2167 * Bug in Windows. If the combo box has the CBS_SIMPLE style, | 2185 * Bug in Windows. If the combo box has the CBS_SIMPLE style, |
2168 * the list portion of the combo box is not redrawn when the | 2186 * the list portion of the combo box is not redrawn when the |
2169 * combo box is resized. The fix is to force a redraw when | 2187 * combo box is resized. The fix is to force a redraw when |
2170 * the size has changed. | 2188 * the size has changed. |
2219 * WM_SIZE message. | 2237 * WM_SIZE message. |
2220 */ | 2238 */ |
2221 if (isDisposed ()) return result; | 2239 if (isDisposed ()) return result; |
2222 if (buffer !is null) { | 2240 if (buffer !is null) { |
2223 OS.SetWindowText (handle, buffer.ptr); | 2241 OS.SetWindowText (handle, buffer.ptr); |
2224 int bits = (start & 0xFFFF) | ((end << 16) & 0xFFFF0000); | 2242 int /*long*/ bits = OS.MAKELPARAM (start, end); |
2225 OS.SendMessage (handle, OS.CB_SETEDITSEL, 0, bits); | 2243 OS.SendMessage (handle, OS.CB_SETEDITSEL, 0, bits); |
2226 if (redraw) setRedraw (true); | 2244 if (redraw) setRedraw (true); |
2227 } | 2245 } |
2228 } | 2246 } |
2229 /* | 2247 /* |
2231 * a width that is smaller than the current size of the combo | 2249 * a width that is smaller than the current size of the combo |
2232 * box, it is ignored. This the fix is to set the width after | 2250 * box, it is ignored. This the fix is to set the width after |
2233 * the combo box has been resized. | 2251 * the combo box has been resized. |
2234 */ | 2252 */ |
2235 if ((style & DWT.H_SCROLL) !is 0) setScrollWidth (scrollWidth); | 2253 if ((style & DWT.H_SCROLL) !is 0) setScrollWidth (scrollWidth); |
2254 return result; | |
2255 } | |
2256 | |
2257 override LRESULT WM_WINDOWPOSCHANGING (int /*long*/ wParam, int /*long*/ lParam) { | |
2258 LRESULT result = super.WM_WINDOWPOSCHANGING (wParam, lParam); | |
2259 if (result !is null) return result; | |
2260 /* | |
2261 * Feature in Windows. When a combo box is resized, | |
2262 * the size of the drop down rectangle is specified | |
2263 * using the height and then the combo box resizes | |
2264 * to be the height of the text field. This causes | |
2265 * sibling windows that intersect with the original | |
2266 * bounds to redrawn. The fix is to stop the redraw | |
2267 * using SWP_NOREDRAW and then damage the combo box | |
2268 * text field and the area in the parent where the | |
2269 * combo box used to be. | |
2270 */ | |
2271 if (OS.IsWinCE) return result; | |
2272 if (drawCount !is 0) return result; | |
2273 if (!OS.IsWindowVisible (handle)) return result; | |
2274 if (ignoreResize) { | |
2275 WINDOWPOS* lpwp = cast(WINDOWPOS*)lParam; | |
2276 if ((lpwp.flags & OS.SWP_NOSIZE) is 0) { | |
2277 lpwp.flags |= OS.SWP_NOREDRAW; | |
2278 OS.InvalidateRect (handle, null, true); | |
2279 RECT rect; | |
2280 OS.GetWindowRect (handle, &rect); | |
2281 int width = rect.right - rect.left; | |
2282 int height = rect.bottom - rect.top; | |
2283 if (width !is 0 && height !is 0) { | |
2284 auto hwndParent = parent.handle; | |
2285 auto hwndChild = OS.GetWindow (hwndParent, OS.GW_CHILD); | |
2286 OS.MapWindowPoints (null, hwndParent, cast(POINT*)&rect, 2); | |
2287 auto rgn1 = OS.CreateRectRgn (rect.left, rect.top, rect.right, rect.bottom); | |
2288 while (hwndChild !is null) { | |
2289 if (hwndChild !is handle) { | |
2290 OS.GetWindowRect (hwndChild, &rect); | |
2291 OS.MapWindowPoints (null, hwndParent, cast(POINT*)&rect, 2); | |
2292 auto rgn2 = OS.CreateRectRgn (rect.left, rect.top, rect.right, rect.bottom); | |
2293 OS.CombineRgn (rgn1, rgn1, rgn2, OS.RGN_DIFF); | |
2294 OS.DeleteObject (rgn2); | |
2295 } | |
2296 hwndChild = OS.GetWindow (hwndChild, OS.GW_HWNDNEXT); | |
2297 } | |
2298 int flags = OS.RDW_ERASE | OS.RDW_FRAME | OS.RDW_INVALIDATE; | |
2299 OS.RedrawWindow (hwndParent, null, rgn1, flags); | |
2300 OS.DeleteObject (rgn1); | |
2301 } | |
2302 } | |
2303 } | |
2236 return result; | 2304 return result; |
2237 } | 2305 } |
2238 | 2306 |
2239 override LRESULT wmChar (HWND hwnd, int wParam, int lParam) { | 2307 override LRESULT wmChar (HWND hwnd, int wParam, int lParam) { |
2240 if (ignoreCharacter) return null; | 2308 if (ignoreCharacter) return null; |
2343 } | 2411 } |
2344 return null; | 2412 return null; |
2345 } | 2413 } |
2346 | 2414 |
2347 override LRESULT wmCommandChild (int wParam, int lParam) { | 2415 override LRESULT wmCommandChild (int wParam, int lParam) { |
2348 int code = wParam >> 16; | 2416 int code = OS.HIWORD (wParam); |
2349 switch (code) { | 2417 switch (code) { |
2350 case OS.CBN_EDITCHANGE: | 2418 case OS.CBN_EDITCHANGE: |
2351 if (ignoreModify) break; | 2419 if (ignoreModify) break; |
2352 /* | 2420 /* |
2353 * Feature in Windows. If the combo box list selection is | 2421 * Feature in Windows. If the combo box list selection is |
2427 * using WM_IME_CHAR. The fix is to allow the text | 2495 * using WM_IME_CHAR. The fix is to allow the text |
2428 * widget to get the WM_CHAR's but ignore sending | 2496 * widget to get the WM_CHAR's but ignore sending |
2429 * them to the application. | 2497 * them to the application. |
2430 */ | 2498 */ |
2431 ignoreCharacter = true; | 2499 ignoreCharacter = true; |
2432 int result = callWindowProc (hwnd, OS.WM_IME_CHAR, wParam, lParam); | 2500 int /*long*/ result = callWindowProc (hwnd, OS.WM_IME_CHAR, wParam, lParam); |
2433 MSG msg; | 2501 MSG msg; |
2434 int flags = OS.PM_REMOVE | OS.PM_NOYIELD | OS.PM_QS_INPUT | OS.PM_QS_POSTMESSAGE; | 2502 int flags = OS.PM_REMOVE | OS.PM_NOYIELD | OS.PM_QS_INPUT | OS.PM_QS_POSTMESSAGE; |
2435 while (OS.PeekMessage (&msg, hwnd, OS.WM_CHAR, OS.WM_CHAR, flags)) { | 2503 while (OS.PeekMessage (&msg, hwnd, OS.WM_CHAR, OS.WM_CHAR, flags)) { |
2436 OS.TranslateMessage (&msg); | 2504 OS.TranslateMessage (&msg); |
2437 OS.DispatchMessage (&msg); | 2505 OS.DispatchMessage (&msg); |
2470 int oldSelection = OS.SendMessage (handle, OS.CB_GETCURSEL, 0, 0); | 2538 int oldSelection = OS.SendMessage (handle, OS.CB_GETCURSEL, 0, 0); |
2471 LRESULT result = super.wmSysKeyDown (hwnd, wParam, lParam); | 2539 LRESULT result = super.wmSysKeyDown (hwnd, wParam, lParam); |
2472 if (result !is null) return result; | 2540 if (result !is null) return result; |
2473 if ((style & DWT.READ_ONLY) is 0) { | 2541 if ((style & DWT.READ_ONLY) is 0) { |
2474 if (wParam is OS.VK_DOWN) { | 2542 if (wParam is OS.VK_DOWN) { |
2475 int code = callWindowProc (hwnd, OS.WM_SYSKEYDOWN, wParam, lParam); | 2543 int /*long*/ code = callWindowProc (hwnd, OS.WM_SYSKEYDOWN, wParam, lParam); |
2476 int newSelection = OS.SendMessage (handle, OS.CB_GETCURSEL, 0, 0); | 2544 int newSelection = OS.SendMessage (handle, OS.CB_GETCURSEL, 0, 0); |
2477 if (oldSelection !is newSelection) { | 2545 if (oldSelection !is newSelection) { |
2478 sendEvent (DWT.Modify); | 2546 sendEvent (DWT.Modify); |
2479 if (isDisposed ()) return LRESULT.ZERO; | 2547 if (isDisposed ()) return LRESULT.ZERO; |
2480 sendEvent (DWT.Selection); | 2548 sendEvent (DWT.Selection); |