Esempio n. 1
0
  void click(boolean dropDown) {
    long /*int*/ hwnd = parent.handle;
    if (OS.GetKeyState(OS.VK_LBUTTON) < 0) return;
    int index = (int) /*64*/ OS.SendMessage(hwnd, OS.TB_COMMANDTOINDEX, id, 0);
    RECT rect = new RECT();
    OS.SendMessage(hwnd, OS.TB_GETITEMRECT, index, rect);
    int hotIndex = (int) /*64*/ OS.SendMessage(hwnd, OS.TB_GETHOTITEM, 0, 0);

    /*
     * In order to emulate all the processing that
     * happens when a mnemonic key is pressed, fake
     * a mouse press and release.  This will ensure
     * that radio and pull down items are handled
     * properly.
     */
    int y = rect.top + (rect.bottom - rect.top) / 2;
    long /*int*/ lParam = OS.MAKELPARAM(dropDown ? rect.right - 1 : rect.left, y);
    parent.ignoreMouse = true;
    OS.SendMessage(hwnd, OS.WM_LBUTTONDOWN, 0, lParam);
    OS.SendMessage(hwnd, OS.WM_LBUTTONUP, 0, lParam);
    parent.ignoreMouse = false;

    if (hotIndex != -1) {
      OS.SendMessage(hwnd, OS.TB_SETHOTITEM, hotIndex, 0);
    }
  }
Esempio n. 2
0
 @Override
 LRESULT WM_CHAR(long /*int*/ wParam, long /*int*/ lParam) {
   LRESULT result = super.WM_CHAR(wParam, lParam);
   if (result != null) return result;
   if (caret != null) {
     switch ((int) /*64*/ wParam) {
       case SWT.DEL:
       case SWT.BS:
       case SWT.ESC:
         break;
       default:
         {
           if (OS.GetKeyState(OS.VK_CONTROL) >= 0) {
             int[] value = new int[1];
             if (OS.SystemParametersInfo(OS.SPI_GETMOUSEVANISH, 0, value, 0)) {
               if (value[0] != 0) OS.SetCursor(0);
             }
           }
         }
     }
   }
   return result;
 }