فهرست منبع

输入框焦点的问题,终于解决了

zhangyang 4 سال پیش
والد
کامیت
761fa43b72
2فایلهای تغییر یافته به همراه11 افزوده شده و 13 حذف شده
  1. 10 7
      zhipuzi_pos_windows/wnd/CLoginWnd.cpp
  2. 1 6
      zhipuzi_pos_windows/wnd/CMemberLoginWnd.cpp

+ 10 - 7
zhipuzi_pos_windows/wnd/CLoginWnd.cpp

@@ -136,6 +136,16 @@ void CLoginWnd::Notify(TNotifyUI& msg)
 			pPassword->SetText(wspassword.c_str());
 		}
 	}
+	else if (msg.sType == L"windowinit")
+	{
+		m_pm.SetNextTabControl(false);
+
+		CEditUI* pAccountEdit = static_cast<CEditUI*>(m_pm.FindControl(_T("accountedit")));
+		if (pAccountEdit)
+		{
+			pAccountEdit->SetFocus();
+		}
+	}
 }
 
 LRESULT CLoginWnd::OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
@@ -195,13 +205,6 @@ LRESULT CLoginWnd::OnNcCalcSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& b
 
 LRESULT CLoginWnd::OnNcPaint(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
 {
-	//在这里设置焦点才有用
-	CEditUI* pAccountEdit = static_cast<CEditUI*>(m_pm.FindControl(_T("accountedit")));
-	if (pAccountEdit)
-	{
-		pAccountEdit->SetFocus();
-	}
-
 	return 0;
 }
 

+ 1 - 6
zhipuzi_pos_windows/wnd/CMemberLoginWnd.cpp

@@ -203,15 +203,10 @@ void CMemberLoginWnd::Notify(TNotifyUI& msg)
 	}
 	else if (msg.sType == L"windowinit")
 	{
-		SetFocus(m_hWnd);
+		m_pm.SetNextTabControl(false);
 
 		CEditUI* pFukuanEdit = static_cast<CEditUI*>(m_pm.FindControl(_T("content")));
-
 		pFukuanEdit->SetFocus();
-
-		//RECT rect = pFukuanEdit->GetPos();
-
-		//::SendMessage(m_hWnd, WM_LBUTTONDOWN, NULL, MAKELONG(rect.left, rect.top));
 	}
 	else if (msg.sType == L"killfocus")
 	{