Exemplo n.º 1
0
HWND far pascal zGetNextDlgTabItem( HWND pp1, HWND pp2, BOOL pp3 )
{
    HWND r;

    SaveRegs();
    /*
    ** Log IN Parameters (No Create/Destroy Checking Yet!)
    */
    LogIn( (LPSTR)"APICALL:GetNextDlgTabItem HWND+HWND+BOOL+",
        pp1, pp2, pp3 );

    /*
    ** Call the API!
    */
    RestoreRegs();
    GrovelDS();
    r = GetNextDlgTabItem(pp1,pp2,pp3);
    UnGrovelDS();
    SaveRegs();
    /*
    ** Log Return Code & OUT Parameters (No Create/Destroy Checking Yet!)
    */
    LogOut( (LPSTR)"APIRET:GetNextDlgTabItem HWND++++",
        r, (short)0, (short)0, (short)0 );

    RestoreRegs();
    return( r );
}
Exemplo n.º 2
0
HWND _get_next_enabled_item(
		HWND h_dialog,
		HWND h_first,
		BOOL b_next
	)
{
	HWND h_last_item = h_first;
	HWND h_find_item;

	do 
	{
		h_find_item = GetNextDlgTabItem( h_dialog, h_last_item, ! b_next );
		if ( h_find_item == h_first )
		{
			break;
		}
		if ( IsWindowEnabled( h_find_item ) ) 
		{
			return h_find_item;
		}
		h_last_item = h_find_item;

	} while ( 1 );

	return h_first;
}
Exemplo n.º 3
0
Arquivo: swnd.c Projeto: goriy/sif
LRESULT CALLBACK manPathInputProc(HWND wnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
  if (msg == WM_GETDLGCODE) return DLGC_WANTALLKEYS;
  switch (msg)  {
    case WM_KEYDOWN:
      //printf ("VM_KEYDOWN %X\n", wParam);
      switch (wParam)  {
        case VK_RETURN:
          //Do your stuff
          on_update_click ();
          return 0;
          break;  //or return 0; if you don't want to pass it further to def proc
                  //If not your key, skip to default:
        case VK_TAB:
          SetFocus (GetNextDlgTabItem(hMainWindow, wnd, GetAsyncKeyState(VK_SHIFT) & 0x8000 ? TRUE : FALSE));
          return 0;

        default:
          return CallWindowProc(oldManPathProc, wnd, msg, wParam, lParam);
      }
    default:
      //printf ("msg = 0x%X %X %X\n", msg, wParam, lParam);
      return CallWindowProc(oldManPathProc, wnd, msg, wParam, lParam);
   }
   return 0;
}
Exemplo n.º 4
0
void CEkiView::OnSetFocus(CWnd* pOldWnd) 
{
	//CView::OnSetFocus(pOldWnd);
	CWnd*	pControl = GetNextDlgTabItem( (CWnd*)NULL , FALSE ) ;
	pControl->SetFocus() ;
	
}
Exemplo n.º 5
0
HWND uie::window::g_on_tab(HWND wnd_focus)
{
	HWND rv = 0;
	
	HWND wnd_temp = GetAncestor(wnd_focus, GA_ROOT);/*_GetParent(wnd_focus);
	
	while (wnd_temp && GetWindowLong(wnd_temp, GWL_EXSTYLE) & WS_EX_CONTROLPARENT)
	{
		if (GetWindowLong(wnd_temp, GWL_STYLE) & WS_POPUP) break;
		else wnd_temp = _GetParent(wnd_temp);
	}*/
	
	if (wnd_temp)
	{
		HWND wnd_next = GetNextDlgTabItem(wnd_temp, wnd_focus, (GetKeyState(VK_SHIFT) & KF_UP) ? TRUE :  FALSE);
		if (wnd_next && wnd_next != wnd_focus) 
		{
			unsigned flags = uSendMessage(wnd_next, WM_GETDLGCODE, 0, 0);
			if (flags & DLGC_HASSETSEL) uSendMessage(wnd_next, EM_SETSEL, 0, -1);
			SetFocus(wnd_next);
			
			rv = wnd_next;
		}
	}
	return rv;
};
Exemplo n.º 6
0
static void
show_tab_panel(HWND hwnd,
               khui_config_node node,
               HWND hw_tab,
               int idx,
               BOOL show) {
    TCITEM tci;
    HWND hw;
    HWND hw_target;
    HWND hw_firstctl;
    RECT r;
    RECT rref;
    khui_config_node_reg reg;

    ZeroMemory(&tci, sizeof(tci));

    tci.mask = TCIF_PARAM;
    TabCtrl_GetItem(hw_tab,
                    idx,
                    &tci);

#ifdef DEBUG
    assert(tci.lParam);
#endif
    khui_cfg_get_reg((khui_config_node) tci.lParam, &reg);
    if (reg.flags & KHUI_CNFLAG_PLURAL)
        hw = khui_cfg_get_hwnd_inst((khui_config_node) tci.lParam,
                                    node);
    else
        hw = khui_cfg_get_hwnd((khui_config_node) tci.lParam);
#ifdef DEBUG
    assert(hw);
#endif

    if (!show) {
        ShowWindow(hw, SW_HIDE);
        return;
    }

    hw_target = GetDlgItem(hwnd, IDC_CFG_TARGET);
#ifdef DEBUG
    assert(hw_target);
#endif
    GetWindowRect(hwnd, &rref);
    GetWindowRect(hw_target, &r);

    OffsetRect(&r, -rref.left, -rref.top);

    SetWindowPos(hw,
                 hw_tab,
                 r.left, r.top,
                 r.right - r.left, r.bottom - r.top,
                 SWP_NOACTIVATE | SWP_NOOWNERZORDER |
                 SWP_SHOWWINDOW);

    hw_firstctl = GetNextDlgTabItem(hw, NULL, FALSE);
    if (hw_firstctl) {
        SetFocus(hw_firstctl);
    }
}
Exemplo n.º 7
0
static void test_SaveRestoreFocus(void)
{
    HWND hDlg;
    HRSRC hResource;
    HANDLE hTemplate;
    DLGTEMPLATE* pTemplate;
    LONG_PTR foundId;
    HWND foundHwnd;

    /* create the dialog */
    hResource = FindResourceA(g_hinst, "MULTI_EDIT_DIALOG", RT_DIALOG);
    hTemplate = LoadResource(g_hinst, hResource);
    pTemplate = LockResource(hTemplate);

    hDlg = CreateDialogIndirectParamA(g_hinst, pTemplate, NULL, messageBoxFontDlgWinProc, 0);
    ok (hDlg != 0, "Failed to create test dialog.\n");

    foundId = GetWindowLongPtr(GetFocus(), GWLP_ID);
    ok (foundId == 1000, "First edit box should have gained focus on dialog creation. Expected: %d, Found: %ld\n", 1000, foundId);

    /* de- then reactivate the dialog */
    SendMessage(hDlg, WM_ACTIVATE, MAKEWPARAM(WA_INACTIVE, 0), 0);
    SendMessage(hDlg, WM_ACTIVATE, MAKEWPARAM(WA_ACTIVE, 0), 0);

    foundId = GetWindowLongPtr(GetFocus(), GWLP_ID);
    ok (foundId == 1000, "First edit box should have regained focus after dialog reactivation. Expected: %d, Found: %ld\n", 1000, foundId);

    /* select the next tabbable item */
    SetFocus(GetNextDlgTabItem(hDlg, GetFocus(), FALSE));

    foundId = GetWindowLongPtr(GetFocus(), GWLP_ID);
    ok (foundId == 1001, "Second edit box should have gained focus. Expected: %d, Found: %ld\n", 1001, foundId);

    /* de- then reactivate the dialog */
    SendMessage(hDlg, WM_ACTIVATE, MAKEWPARAM(WA_INACTIVE, 0), 0);
    SendMessage(hDlg, WM_ACTIVATE, MAKEWPARAM(WA_ACTIVE, 0), 0);

    foundId = GetWindowLongPtr(GetFocus(), GWLP_ID);
    ok (foundId == 1001, "Second edit box should have gained focus after dialog reactivation. Expected: %d, Found: %ld\n", 1001, foundId);

    /* disable the 2nd box */
    EnableWindow(GetFocus(), FALSE);

    foundHwnd = GetFocus();
    ok (foundHwnd == NULL, "Second edit box should have lost focus after being disabled. Expected: %p, Found: %p\n", NULL, foundHwnd);

    /* de- then reactivate the dialog */
    SendMessage(hDlg, WM_ACTIVATE, MAKEWPARAM(WA_INACTIVE, 0), 0);
    SendMessage(hDlg, WM_ACTIVATE, MAKEWPARAM(WA_ACTIVE, 0), 0);

    foundHwnd = GetFocus();
    ok (foundHwnd == NULL, "No controls should have gained focus after dialog reactivation. Expected: %p, Found: %p\n", NULL, foundHwnd);

    /* clean up */
    DestroyWindow(hDlg);
}
Exemplo n.º 8
0
void VDUIBaseWindowW32::FinalizeDialog() {
	Relayout();

	if (mhwnd && GetFocus() == mhwnd) {
		// must init focus to a control or else shortcuts don't work at first
		HWND hwndFirstFocus = GetNextDlgTabItem(mhwnd, NULL, FALSE);
		if (hwndFirstFocus)
			::SetFocus(hwndFirstFocus);
	}
}
Exemplo n.º 9
0
void CTradeFundHSOpenDlg::OnOK()
{
	CWnd* pFocus = GetFocus();
	CWnd *pWnd = GetNextDlgTabItem(pFocus,FALSE);
	if (((&m_btOK) == pFocus) || ((&m_btOK) == pWnd))
	{
		OnBnClickedBtOk();
		return;
	}
	__super::OnOK();
}
Exemplo n.º 10
0
void CTestDlg::OnOK() 
{
	// TODO: Add extra validation here
	// 先获取当前具有焦点的窗口的指针,再根据这个指针来转移焦点到下一个窗口
	//GetDlgItem(IDC_EDIT1)->GetNextWindow()->SetFocus();
	//GetFocus()->GetNextWindow()->SetFocus();
	//GetFocus()->GetWindow(GW_HWNDNEXT)->SetFocus();
	GetNextDlgTabItem(GetFocus())->SetFocus();
	//CDialog::OnOK();

}
Exemplo n.º 11
0
HWND _get_next_enabled_tab_item(
		HWND h_dialog,
		HWND h_first_item,
		BOOL b_next
	)
{
	return 
	(
		IsWindowEnabled( h_first_item ) ? 
		h_first_item : GetNextDlgTabItem( h_dialog, h_first_item, ! b_next )
	);
}
Exemplo n.º 12
0
static void show_hide_page (PPROPPAGE page, int show_cmd)
{
    HWND focus;
    
    ShowWindow (page->hwnd, show_cmd);

    focus = GetNextDlgTabItem (page->hwnd, (HWND)0, 0);
    if (SendMessage (page->hwnd, MSG_SHOWPAGE, focus, show_cmd) && show_cmd == SW_SHOW) {
        if (focus) {
            SetFocus (focus);
        }
    }
}
Exemplo n.º 13
0
static void hugsprim_GetNextDlgTabItem_16(HugsStackPtr hugs_root)
{
    HsPtr arg1;
    HsPtr arg2;
    HsBool arg3;
    HsPtr res1;
    arg1 = hugs->getPtr();
    arg2 = hugs->getPtr();
    arg3 = hugs->getBool();
    res1 = GetNextDlgTabItem(arg1, arg2, arg3);
    hugs->putPtr(res1);
    hugs->returnIO(hugs_root,1);
}
Exemplo n.º 14
0
ULONG FASTCALL WU32GetNextDlgTabItem(PVDMFRAME pFrame)
{
    ULONG ul;
    register PGETNEXTDLGTABITEM16 parg16;

    GETARGPTR(pFrame, sizeof(GETNEXTDLGTABITEM16), parg16);

    ul = GETHWND16(GetNextDlgTabItem(HWND32(parg16->f1),
                                     HWND32(parg16->f2),
                                     BOOL32(parg16->f3)));

    FREEARGPTR(parg16);
    RETURN(ul);
}
Exemplo n.º 15
0
static INT_PTR CALLBACK TestInitDialogHandleProc (HWND hDlg, UINT uiMsg,
        WPARAM wParam, LPARAM lParam)
{
    if (uiMsg == WM_INITDIALOG)
    {
        HWND expected = GetNextDlgTabItem(hDlg, NULL, FALSE);
        ok(expected == (HWND)wParam,
           "Expected wParam to be the handle to the first tabstop control (%p), got %p\n",
           expected, (HWND)wParam);

        EndDialog(hDlg, LOWORD(SendMessage(hDlg, DM_GETDEFID, 0, 0)));
        return TRUE;
    }
    return FALSE;
}
Exemplo n.º 16
0
HWND _get_last_tab_item(
		HWND h_dialog,
		HWND h_first_item
	)
{
	HWND h_last = h_first_item;
	HWND h_find;

	if ( h_first_item == HWND_NULL ) return HWND_NULL;
	while (	( h_find = GetNextDlgTabItem( h_dialog, h_last, FALSE ) ) != h_first_item )
	{
		h_last = h_find;
	}
	return h_last;
}
Exemplo n.º 17
0
void COTPPancel::OnChangeEditImei2() 
{
	// TODO: If this is a RICHEDIT control, the control will not
	// send this notification unless you override the CDialog::OnInitDialog()
	// function and call CRichEditCtrl().SetEventMask()
	// with the ENM_CHANGE flag ORed into the mask.
	
	// TODO: Add your control notification handler code here
	UpdateData(TRUE);
	strcpy(gIMEI2.szIMEI2,m_IMEI2.GetBuffer(0));
	if (15 == m_IMEI2.GetLength())
	{
		strncpy(gIMEI2.szIMEI2,m_IMEI2.GetBuffer(0), 14);
		gIMEI2.szIMEI2[14]='\0';
		GetNextDlgTabItem(GetFocus())->SetFocus();
	}
}
LRESULT CXTPTaskDialogFrame::OnDialogEnableButton(WPARAM wParam, LPARAM lParam)
{
    CWnd* pWnd = DYNAMIC_DOWNCAST(CButton, GetDlgItem((UINT)wParam));
    if (!pWnd)
        return FALSE;


    if (!lParam && (::GetFocus() == pWnd->GetSafeHwnd()))
    {
        CWnd* pWndNext = GetNextDlgTabItem(pWnd);
        PostMessage(WM_NEXTDLGCTL, (WPARAM)pWndNext->GetSafeHwnd(), TRUE);
    }

    pWnd->EnableWindow(lParam != 0);

    return TRUE;
}
Exemplo n.º 19
0
BOOL CALLBACK OverrideEditCtrlWndProc(HWND hWnd, UINT Message, WPARAM wParam, LPARAM lParam)
{
	switch (Message)
	{
		case WM_GETDLGCODE:
			return DLGC_WANTALLKEYS;

		case WM_SETFOCUS:
			SendMessage(hWnd, EM_SETSEL, 0, -1);
			break;

		case WM_CHAR:
			if (wParam == VK_TAB)
			{
				SetFocus(GetNextDlgTabItem(GetParent(hWnd), hWnd, FALSE));
				return 0;
			}
			else if (wParam == VK_RETURN)
			{
				int val;
				char text[4];
				GetWindowText(hWnd, text, 4);
				val = atoi(text);

				if (hColourLineValues[LINE_H] == hWnd)
					SetColourH(&session.current_colour, val);
				else if (hColourLineValues[LINE_S] == hWnd)
					SetColourS(&session.current_colour, val);
				else if (hColourLineValues[LINE_V] == hWnd)
					SetColourV(&session.current_colour, val);
				else if (hColourLineValues[LINE_R] == hWnd)
					SetColourR(&session.current_colour, val);
				else if (hColourLineValues[LINE_G] == hWnd)
					SetColourG(&session.current_colour, val);
				else if (hColourLineValues[LINE_B] == hWnd)
					SetColourB(&session.current_colour, val);

				RedrawColourBlocks();
				return 0;
			}
			break;
	}

	return CallWindowProc((WNDPROC)GetWindowLong(hWnd, GWL_USERDATA), hWnd, Message, wParam, lParam);
}
Exemplo n.º 20
0
void CMainDialog::OnEditChange(UINT wNotifyCode, int wID, HWND hWndCtl)
{
	ATLTRACE(_T("OnEditChange %d,%d,%d\n"), wNotifyCode, wID, hWndCtl);
	CEdit wndEdit(hWndCtl);
	int endPos = wndEdit.GetLimitText();
	if (wndEdit.GetWindowTextLength() == endPos)
	{
		int startChar = 0, endChar = 0;
		wndEdit.GetSel(startChar, endChar);
		if (startChar == endPos)
		{
			ATLTRACE(_T("Goto next\n"), wNotifyCode, wID, hWndCtl);
			CWindow wndNext = GetNextDlgTabItem(hWndCtl);
			wndNext.SetFocus();
			CEdit wndNextEdit = wndNext;
			wndNextEdit.SetSel(0, -1);
		}
	}
}
Exemplo n.º 21
0
LRESULT CDialog::HandleInitDialog(WPARAM, LPARAM)
{
	PreInitDialog();

#ifndef _AFX_NO_OCC_SUPPORT
	// create OLE controls
	COccManager* pOccManager = afxOccManager;
	if ((pOccManager != NULL) && (m_pOccDialogInfo != NULL))
	{
		BOOL bDlgInit;
		if (m_lpDialogInit != NULL)
			bDlgInit = pOccManager->CreateDlgControls(this, m_lpDialogInit,
				m_pOccDialogInfo);
		else
			bDlgInit = pOccManager->CreateDlgControls(this, m_lpszTemplateName,
				m_pOccDialogInfo);

		if (!bDlgInit)
		{
			TRACE0("Warning: CreateDlgControls failed during dialog init.\n");
			EndDialog(-1);
			return FALSE;
		}
	}
#endif

	// Default will call the dialog proc, and thus OnInitDialog
	BOOL bResult = Default();

#ifndef _AFX_NO_OCC_SUPPORT
	if (bResult && (m_nFlags & WF_OLECTLCONTAINER))
	{
		CWnd* pWndNext = GetNextDlgTabItem(NULL);
		if (pWndNext != NULL)
		{
			pWndNext->SetFocus();   // UI Activate OLE control
			bResult = FALSE;
		}
	}
#endif

	return bResult;
}
Exemplo n.º 22
0
LRESULT CALLBACK Candify::TabControlProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	WNDPROC proc = (WNDPROC)GetWindowLong(hWnd, GWL_USERDATA);

	switch (message)
	{
	case WM_KEYDOWN:
		{
			if (wParam == VK_TAB) {
				HWND hParent, hNextCtrl;

				hParent = GetParent(hWnd);
				hNextCtrl = GetNextDlgTabItem(hParent, hWnd, FALSE);
				SetFocus(hNextCtrl);
				return 0;
			}
		}
	}

	return proc(hWnd, message, wParam, lParam);
}
Exemplo n.º 23
0
_focus_tab(
		int  h_parent_first_tab_id,
		HWND h_parent,
		HWND h_page,
		HWND h_page_first_tab,
		BOOL b_next
	)
{
	HWND h_current_tab   = GetFocus( );
	HWND h_next_tab      = GetNextDlgTabItem( GetParent( h_current_tab ), h_current_tab, ! b_next );

	HWND h_wiz_first_tab = _get_next_enabled_tab_item( h_parent, GetDlgItem( h_parent, h_parent_first_tab_id ), b_next );
	HWND h_wiz_last_tab  = _get_last_tab_item( h_parent, h_wiz_first_tab );

	HWND h_page_last_tab = _get_last_tab_item( h_page, h_page_first_tab );

	if ( b_next )
	{
		if ( ( h_current_tab == h_wiz_last_tab ) && ( h_page_first_tab != HWND_NULL ) )
		{
			h_next_tab = h_page_first_tab;
		}
		if ( h_current_tab == h_page_last_tab )
		{
			h_next_tab = h_wiz_first_tab;
		}
	} else {
		if ( ( h_current_tab == h_wiz_first_tab ) && ( h_page_first_tab != HWND_NULL ) )
		{
			h_next_tab = h_page_last_tab;
		}
		if ( h_current_tab == h_page_first_tab )
		{
			h_next_tab = h_wiz_last_tab;
		}
	}
	SetFocus( h_next_tab );

}
Exemplo n.º 24
0
Arquivo: swnd.c Projeto: goriy/sif
LRESULT CALLBACK searchInputProc(HWND wnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
const char *txt;

  if (msg == WM_GETDLGCODE) return DLGC_WANTALLKEYS;
  switch (msg)  {
    case WM_KEYDOWN:
      switch (wParam)  {
        case VK_RETURN:
          //Do your stuff
          on_search_click ();
          return 0;
          break;  //or return 0; if you don't want to pass it further to def proc
                  //If not your key, skip to default:
        case VK_DOWN:
          txt = recent_current_decrement ();
          Edit_SetText (wnd, txt);
          Edit_SetSel (wnd, 0, -1);
          return 0;
          break;
        case VK_UP:
          txt = recent_current_increment ();
          Edit_SetText (wnd, txt);
          Edit_SetSel (wnd, 0, -1);
          return 0;
          break;
        case VK_TAB:
          SetFocus (GetNextDlgTabItem(hMainWindow, wnd, GetAsyncKeyState(VK_SHIFT) & 0x8000 ? TRUE : FALSE));
          return 0;
        default:
          return CallWindowProc(oldsearchInputProc, wnd, msg, wParam, lParam);
      }
    default:
      //printf ("msg = 0x%X %X %X\n", msg, wParam, lParam);
      return CallWindowProc(oldsearchInputProc, wnd, msg, wParam, lParam);
   }
   return 0;
}
Exemplo n.º 25
0
bool playlist_view::process_keydown(UINT msg, LPARAM lp, WPARAM wp, bool playlist, bool keyb)
{
    static_api_ptr_t<keyboard_shortcut_manager> keyboard_api;

    if (msg == WM_SYSKEYDOWN)
    {
        if (keyb && uie::window::g_process_keydown_keyboard_shortcuts(wp))
        {
            return true;
        }
    }
    else if (msg == WM_KEYDOWN)
    {
        if (keyb && uie::window::g_process_keydown_keyboard_shortcuts(wp))
        {
            return true;
        }
        if (wp == VK_TAB)
        {
            uie::window::g_on_tab(GetFocus());
#if 0
            HWND wnd_focus = GetFocus();
            HWND wnd_temp = GetParent(wnd_focus);

            while (GetWindowLong(wnd_temp, GWL_EXSTYLE) & WS_EX_CONTROLPARENT)
            {
                wnd_temp = GetParent(wnd_temp);
            }

            HWND wnd_next = GetNextDlgTabItem(wnd_temp, wnd_focus, (GetAsyncKeyState(VK_SHIFT) & KF_UP) ? TRUE : FALSE);

            if (wnd_next && wnd_next != wnd_focus) SetFocus(wnd_next);
#endif

        }
    }
    return false;
}
Exemplo n.º 26
0
void Server_OnKey_Tab (HWND hDlg, BOOL fForward)
{
   // The tab-cycle should go:
   //    TabControl <-> TabChildControls
   //
   HWND hFocus = GetFocus();
   HWND hTabChild = GetTabChild (GetDlgItem (hDlg, IDC_TABS));

   if (fForward)
      {
      if (hFocus == GetDlgItem (hDlg, IDC_TABS))
         {
         PostMessage (hDlg, WM_NEXTDLGCTL, (WPARAM)GetNextDlgTabItem (hTabChild, NULL, FALSE), TRUE);
         }
      else
         {
         if (GetNextDlgTabItem (hTabChild, hFocus, FALSE) == GetNextDlgTabItem (hTabChild, NULL, FALSE))
            PostMessage (hDlg, WM_NEXTDLGCTL, (WPARAM)GetDlgItem (hDlg, IDC_TABS), TRUE);
         else
            PostMessage (hDlg, WM_NEXTDLGCTL, (WPARAM)GetNextDlgTabItem (hTabChild, hFocus, FALSE), TRUE);
         }
      }
   else // (!fForward)
      {
      if (hFocus == GetDlgItem (hDlg, IDC_TABS))
         {
         PostMessage (hDlg, WM_NEXTDLGCTL, (WPARAM)GetLastDlgTabItem (hTabChild), TRUE);
         }
      else
         {
         if (hFocus == GetNextDlgTabItem (hTabChild, NULL, FALSE))
            PostMessage (hDlg, WM_NEXTDLGCTL, (WPARAM)GetDlgItem (hDlg, IDC_TABS), TRUE);
         else
            PostMessage (hDlg, WM_NEXTDLGCTL, (WPARAM)GetNextDlgTabItem (hTabChild, hFocus, TRUE), TRUE);
         }
      }
}
Exemplo n.º 27
0
void CPpgIntergraph::OnAdvanceFocusNextOrigz()  {
    GetNextDlgTabItem( &m_origZ )->SetFocus();
}
Exemplo n.º 28
0
static void test_wiznavigation(void)
{
    HPROPSHEETPAGE hpsp[4];
    PROPSHEETPAGEA psp[4];
    PROPSHEETHEADERA psh;
    HWND hdlg, control;
    LONG_PTR controlID;
    DWORD style;
    LRESULT defidres;
    BOOL hwndtoindex_supported = TRUE;
    const INT nextID = 12324;
    const INT backID = 12323;
    HHOOK hook;

    /* set up a hook proc in order to subclass the main dialog early on */
    hook = SetWindowsHookExW( WH_CBT, hook_proc, NULL, GetCurrentThreadId() );

    /* create the property sheet pages */
    memset(psp, 0, sizeof(PROPSHEETPAGEA) * 4);

    psp[0].dwSize = sizeof(PROPSHEETPAGEA);
    psp[0].hInstance = GetModuleHandleA(NULL);
    U(psp[0]).pszTemplate = (LPCSTR)MAKEINTRESOURCE(IDD_PROP_PAGE_INTRO);
    psp[0].pfnDlgProc = nav_page_proc;
    hpsp[0] = CreatePropertySheetPageA(&psp[0]);

    psp[1].dwSize = sizeof(PROPSHEETPAGEA);
    psp[1].hInstance = GetModuleHandleA(NULL);
    U(psp[1]).pszTemplate = (LPCSTR)MAKEINTRESOURCE(IDD_PROP_PAGE_EDIT);
    psp[1].pfnDlgProc = nav_page_proc;
    hpsp[1] = CreatePropertySheetPageA(&psp[1]);

    psp[2].dwSize = sizeof(PROPSHEETPAGEA);
    psp[2].hInstance = GetModuleHandleA(NULL);
    U(psp[2]).pszTemplate = (LPCSTR)MAKEINTRESOURCE(IDD_PROP_PAGE_RADIO);
    psp[2].pfnDlgProc = nav_page_proc;
    hpsp[2] = CreatePropertySheetPageA(&psp[2]);

    psp[3].dwSize = sizeof(PROPSHEETPAGEA);
    psp[3].hInstance = GetModuleHandleA(NULL);
    U(psp[3]).pszTemplate = (LPCSTR)MAKEINTRESOURCE(IDD_PROP_PAGE_EXIT);
    psp[3].pfnDlgProc = nav_page_proc;
    hpsp[3] = CreatePropertySheetPageA(&psp[3]);

    /* set up the property sheet dialog */
    memset(&psh, 0, sizeof(psh));
    psh.dwSize = PROPSHEETHEADERA_V1_SIZE;
    psh.dwFlags = PSH_MODELESS | PSH_WIZARD;
    psh.pszCaption = "A Wizard";
    psh.nPages = 4;
    psh.hwndParent = GetDesktopWindow();
    U3(psh).phpage = hpsp;
    hdlg = (HWND)PropertySheetA(&psh);
    ok(hdlg != INVALID_HANDLE_VALUE, "got invalid handle %p\n", hdlg);

    ok(active_page == 0, "Active page should be 0. Is: %d\n", active_page);

    style = GetWindowLongA(hdlg, GWL_STYLE) & ~(DS_CONTEXTHELP|WS_SYSMENU);
    ok(style == (WS_POPUP|WS_VISIBLE|WS_CLIPSIBLINGS|WS_CAPTION|
                 DS_MODALFRAME|DS_SETFONT|DS_3DLOOK),
       "got unexpected style: %x\n", style);

    control = GetFocus();
    controlID = GetWindowLongPtrA(control, GWLP_ID);
    ok(controlID == nextID, "Focus should have been set to the Next button. Expected: %d, Found: %ld\n", nextID, controlID);

    /* simulate pressing the Next button */
    SendMessageA(hdlg, PSM_PRESSBUTTON, PSBTN_NEXT, 0);
    if (!active_page) hwndtoindex_supported = FALSE;
    if (hwndtoindex_supported)
        ok(active_page == 1, "Active page should be 1 after pressing Next. Is: %d\n", active_page);

    control = GetFocus();
    controlID = GetWindowLongPtrA(control, GWLP_ID);
    ok(controlID == IDC_PS_EDIT1, "Focus should be set to the first item on the second page. Expected: %d, Found: %ld\n", IDC_PS_EDIT1, controlID);

    defidres = SendMessageA(hdlg, DM_GETDEFID, 0, 0);
    ok(defidres == MAKELRESULT(nextID, DC_HASDEFID), "Expected default button ID to be %d, is %d\n", nextID, LOWORD(defidres));

    /* set the focus to the second edit box on this page */
    SetFocus(GetNextDlgTabItem(hdlg, control, FALSE));

    /* press next again */
    SendMessageA(hdlg, PSM_PRESSBUTTON, PSBTN_NEXT, 0);
    if (hwndtoindex_supported)
        ok(active_page == 2, "Active page should be 2 after pressing Next. Is: %d\n", active_page);

    control = GetFocus();
    controlID = GetWindowLongPtrA(control, GWLP_ID);
    ok(controlID == IDC_PS_RADIO1, "Focus should have been set to item on third page. Expected: %d, Found %ld\n", IDC_PS_RADIO1, controlID);

    /* back button */
    SendMessageA(hdlg, PSM_PRESSBUTTON, PSBTN_BACK, 0);
    if (hwndtoindex_supported)
        ok(active_page == 1, "Active page should be 1 after pressing Back. Is: %d\n", active_page);

    control = GetFocus();
    controlID = GetWindowLongPtrA(control, GWLP_ID);
    ok(controlID == IDC_PS_EDIT1, "Focus should have been set to the first item on second page. Expected: %d, Found %ld\n", IDC_PS_EDIT1, controlID);

    defidres = SendMessageA(hdlg, DM_GETDEFID, 0, 0);
    ok(defidres == MAKELRESULT(backID, DC_HASDEFID), "Expected default button ID to be %d, is %d\n", backID, LOWORD(defidres));

    /* press next twice */
    SendMessageA(hdlg, PSM_PRESSBUTTON, PSBTN_NEXT, 0);
    if (hwndtoindex_supported)
        ok(active_page == 2, "Active page should be 2 after pressing Next. Is: %d\n", active_page);
    SendMessageA(hdlg, PSM_PRESSBUTTON, PSBTN_NEXT, 0);
    if (hwndtoindex_supported)
        ok(active_page == 3, "Active page should be 3 after pressing Next. Is: %d\n", active_page);
    else
        active_page = 3;

    control = GetFocus();
    controlID = GetWindowLongPtrA(control, GWLP_ID);
    ok(controlID == nextID, "Focus should have been set to the Next button. Expected: %d, Found: %ld\n", nextID, controlID);

    /* try to navigate away, but shouldn't be able to */
    SendMessageA(hdlg, PSM_PRESSBUTTON, PSBTN_BACK, 0);
    ok(active_page == 3, "Active page should still be 3 after pressing Back. Is: %d\n", active_page);

    defidres = SendMessageA(hdlg, DM_GETDEFID, 0, 0);
    ok(defidres == MAKELRESULT(nextID, DC_HASDEFID), "Expected default button ID to be %d, is %d\n", nextID, LOWORD(defidres));

    DestroyWindow(hdlg);
    UnhookWindowsHookEx( hook );
}
Exemplo n.º 29
0
static int CALLBACK HotKeyControlProc(HWND hwnd, UINT msg,
				      WPARAM wParam, LPARAM lParam)
{
    LONG hotkey;
    static LONG oldhotkey = 0;
    static unsigned int firstmessage = FALSE;

    switch (msg) {
    case WM_GETDLGCODE:
	return DLGC_WANTALLKEYS;
    case WM_CHAR:
    case WM_DEADCHAR:
    case WM_SYSDEADCHAR:
    case WM_SYSCHAR:
	return FALSE;
    case WM_KEYDOWN:
    case WM_SYSKEYDOWN:
	{
	    UINT modifiers, vkey;
	    char buf[BUFSIZE];

	    firstmessage = TRUE;

	    modifiers = 0;
	    vkey = wParam;

	    if (GetAsyncKeyState(VK_SHIFT))
		modifiers |= MOD_SHIFT;
	    if (GetAsyncKeyState(VK_CONTROL))
		modifiers |= MOD_CONTROL;
	    if (GetAsyncKeyState(VK_MENU))
		modifiers |= MOD_ALT;
	    if (GetAsyncKeyState(VK_LWIN) || GetAsyncKeyState(VK_RWIN))
		modifiers |= MOD_WIN;

	    if (!modifiers ||
		(((modifiers == MOD_CONTROL) ||
		  (modifiers == MOD_ALT) ||
		  (modifiers == MOD_SHIFT)) &&
		 (vkey >= 0x30 && vkey <= 0x5a)))
		return TRUE;

	    oldhotkey = GetWindowLong(hwnd, GWL_USERDATA);

	    key_name(modifiers, vkey, buf, BUFSIZE);
	    SendMessage(hwnd, WM_SETTEXT, 0, (LPARAM) buf);

	    return FALSE;
	};
    case WM_KEYUP:
    case WM_SYSKEYUP:
	{
	    UINT modifiers, vkey;
	    char buf[BUFSIZE];
	    unsigned int modf = 0;

	    if (!firstmessage)
		return FALSE;
	    else
		firstmessage = FALSE;

	    modifiers = 0;
	    vkey = wParam;

	    switch (vkey) {
	    case VK_BACK:
	    case VK_CLEAR:
		hotkey = 0;
		SetWindowLong(hwnd, GWL_USERDATA, hotkey);
		SendMessage(hwnd, WM_SETTEXT, 0, (LPARAM) HOTKEY_NONE);
		SendMessage(hwnd, EM_SETMODIFY, (WPARAM) TRUE, 0);
		SendMessage(GetParent(hwnd), WM_COMMAND,
			    MAKEWPARAM(GetDlgCtrlID(hwnd), HK_CHANGE),
			    (LPARAM) hwnd);

		return FALSE;
	    case VK_TAB:
		hotkey = GetWindowLong(hwnd, GWL_USERDATA);
		if (hotkey) {
		    modifiers = LOWORD(hotkey);
		    vkey = HIWORD(hotkey);
		    key_name(modifiers, vkey, buf, BUFSIZE);
		    SendMessage(hwnd, WM_SETTEXT, 0, (LPARAM) buf);
		} else
		    SendMessage(hwnd, WM_SETTEXT, 0, (LPARAM) HOTKEY_NONE);
		SendMessage(hwnd, EM_SETMODIFY, (WPARAM) TRUE, 0);
		SetFocus(GetNextDlgTabItem(GetParent(hwnd),
					   hwnd,
					   GetAsyncKeyState(VK_SHIFT)));

		return FALSE;
	    case VK_RETURN:
		PostMessage(GetParent(hwnd), WM_COMMAND, (WPARAM) IDOK, 0);

		return FALSE;
	    case VK_ESCAPE:
		hotkey = GetWindowLong(hwnd, GWL_USERDATA);
		if (hotkey) {
		    modifiers = LOWORD(hotkey);
		    vkey = HIWORD(hotkey);
		    key_name(modifiers, vkey, buf, BUFSIZE);
		    SendMessage(hwnd, WM_SETTEXT, 0, (LPARAM) buf);
		} else
		    SendMessage(hwnd, WM_SETTEXT, 0, (LPARAM) HOTKEY_NONE);
		SendMessage(hwnd, EM_SETMODIFY, (WPARAM) TRUE, 0);
		PostMessage(GetParent(hwnd), WM_COMMAND, (WPARAM) IDCANCEL,
			    0);

		return FALSE;
	    };

	    if (GetAsyncKeyState(VK_SHIFT)) {
		modifiers |= MOD_SHIFT;
		modf++;
	    };
	    if (GetAsyncKeyState(VK_CONTROL)) {
		modifiers |= MOD_CONTROL;
		modf++;
	    };
	    if (GetAsyncKeyState(VK_MENU)) {
		modifiers |= MOD_ALT;
		modf++;
	    };
	    if (GetAsyncKeyState(VK_LWIN) || GetAsyncKeyState(VK_RWIN)) {
		modifiers |= MOD_WIN;
		modf++;
	    };

	    if (!modifiers ||
		((modf < 2) && !(modifiers & MOD_WIN)) ||
		!((vkey >= 0x30 && vkey <= 0x5a) ||
		  (vkey >= VK_F1 && vkey <= VK_F24))) {
		SetWindowLong(hwnd, GWL_USERDATA, oldhotkey);
		SendMessage(hwnd, WM_SETTEXT, 0, (LPARAM) HOTKEY_NONE);
		SendMessage(hwnd, EM_SETMODIFY, (WPARAM) FALSE, 0);
		return TRUE;
	    };

	    if (RegisterHotKey(hwnd, 0, modifiers, vkey)) {
		hotkey = MAKELPARAM(modifiers, vkey);
		SetWindowLong(hwnd, GWL_USERDATA, hotkey);
		key_name(modifiers, vkey, buf, BUFSIZE);
		SendMessage(hwnd, WM_SETTEXT, 0, (LPARAM) buf);
		UnregisterHotKey(hwnd, 0);
		SendMessage(hwnd, EM_SETMODIFY, (WPARAM) TRUE, 0);
		SendMessage(GetParent(hwnd),
			    WM_COMMAND,
			    MAKEWPARAM(GetDlgCtrlID(hwnd), HK_CHANGE),
			    (LPARAM) hwnd);
	    } else {
		SetWindowLong(hwnd, GWL_USERDATA, oldhotkey);
		SendMessage(hwnd, WM_SETTEXT, 0, (LPARAM) HOTKEY_INVALID);
		SendMessage(hwnd, EM_SETMODIFY, (WPARAM) TRUE, 0);
	    };

	    return FALSE;
	};
    };
    return CallWindowProc(oldwindowproc, hwnd, msg, wParam, lParam);
};
Exemplo n.º 30
0
// That helper function called from root dialog
bool EditIconHint_Process(HWND hDlg, UINT messg, WPARAM wParam, LPARAM lParam, INT_PTR& lResult)
{
	bool bProcessed = false;

	switch (messg)
	{
	case WM_COMMAND:
		{
			WORD wCode = HIWORD(wParam);
			WORD wID = LOWORD(wParam);

			switch (wCode)
			{
			case BN_CLICKED:
				{
					HWND hEdit = GetFocus();
					CEIconHintInfo hi = {};
					if (!gpIconHints->Get(hEdit, &hi))
						break;

					KillTimer(hEdit, SEARCH_CTRL_TIMERID);

					switch (wID)
					{
					case IDOK:
						//It will be processed in WM_KEYUP
						//PostMessage(hEdit, WM_TIMER, SEARCH_CTRL_TIMERID, 0);
						break;
					case IDCANCEL:
						if (GetWindowTextLength(hEdit) > 0)
							SetWindowText(hEdit, L"");
						else
							SetFocus(GetNextDlgTabItem(hDlg, hEdit, TRUE));
						break;
					}

					lResult = 0;
					bProcessed = true;
				}
				// BN_CLICKED
				break;

			case EN_CHANGE:
			case EN_UPDATE:
				{
					HWND hEdit = GetDlgItem(hDlg, wID);

					CEIconHintInfo hi = {};
					if (!gpIconHints->Get(hEdit, &hi))
						break;

					switch (wCode)
					{
					case EN_UPDATE:
						// Redraw search icon
						SetTimer(hEdit, SEARCH_CTRL_REFRID, SEARCH_CTRL_REFR, NULL);
						break;
					case EN_CHANGE:
						// Start search delay on typing
						if (GetWindowTextLength(hEdit) > 0)
							SetTimer(hEdit, SEARCH_CTRL_TIMERID, SEARCH_CTRL_TIMER, 0);
						else
							KillTimer(hEdit, SEARCH_CTRL_TIMERID);
						break;
					}

					lResult = 0;
					bProcessed = true;
					break;
				} // EN_CHANGE, EN_UPDATE

			case EN_SETFOCUS:
				{
					// Autosel text in search control
					HWND hEdit = (HWND)lParam;

					CEIconHintInfo hi = {};
					if (!gpIconHints->Get(hEdit, &hi))
						break;

					SendMessage(hEdit, EM_SETSEL, 0, -1);

					lResult = 0;
					bProcessed = true;
					break;
				} // EN_SETFOCUS

			} // switch (wCode) in WM_COMMAND
		} break; // WM_COMMAND

	case UM_SEARCH_FOCUS:
		{
			CEIconHintInfo hi = {};
			HWND h = NULL;
			while (gpIconHints->GetNext(h ? &h : NULL, &h, &hi))
			{
				if (hi.hRootDlg == hDlg)
				{
					SetFocus(hi.hEditCtrl);
				}
			}
		} break;

	}

	return bProcessed;
}