1
你好我所有的動態創建的小對話框,其中有一個文本框和一個按鈕..如果用戶按下TAB鍵,它必須在兩個控件(文本框和按鈕)之間切換...我嘗試使用SetwindowPos ...但它似乎並沒有解決我的問題...請給我一個解決方案,這..在下面的代碼..我也試圖包括主窗口在taborder ..它不工作如何在win 32中設置UI控件的Tab鍵順序?
//對話框創建
HWND dialogHandle = CreateWindowEx(0,WC_DIALOG,L"Security Alert",WS_OVERLAPPEDWINDOW|WS_VISIBLE,600,300,280,160,NULL,NULL,NULL,NULL);
//create textboxcontrol within the dialog
HWND textBoxHandle = CreateWindowEx(WS_EX_CLIENTEDGE,L"EDIT",L"",WS_CHILD|WS_VISIBLE |ES_PASSWORD | WS_TABSTOP,123,48,110,25,dialogHandle,(HMENU)IDD_TEXTBOX,NULL,NULL);
//create button
HWND buttonHandle = CreateWindowEx(NULL,L"Button",L"OK",WS_CHILD|WS_VISIBLE| WS_TABSTOP,151,85,85,25,dialogHandle,(HMENU)ID_PASSWORD_OK,NULL,NULL);
// setwindowpos
SetWindowPos(NULL,textBoxHandle,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE);
SetWindowPos(textBoxHandle,buttonHandle,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE);
我試過below..it不似乎工作 而(的GetMessage(MSG,NULL,0,0)) \t { \t \t的TranslateMessage(&msg); \t \t DispatchMessage函數(&msg); \t \t的IsDialogMessage(textBoxHandle,&msg); \t \t IsDialogMessage(buttonHandle,&msg); \t} – kiddo 2010-04-06 13:14:59
@Rakesh:您需要傳遞對話句柄,而不是控制句柄。我已經添加了一個例子。 – interjay 2010-04-06 13:23:28
雅它工作..謝謝你的傢伙 – kiddo 2010-04-06 13:35:08