GUI學習筆記之三 滑鼠鍵盤

2022-05-27 02:27:10 字數 918 閱讀 7366

客戶區滑鼠訊息有msg_lbuttondown, msg_lbuttonup, msgmousemove,其中使用fngui_setcapture和fngui_releasecapture來保證某一控制項始終唯一獲取滑鼠資訊。其中lparam表示座標資訊,wparam表示ctrl,shift鍵的狀態。

case msg_lbuttondown:

/*響應down訊息捕獲滑鼠,並記錄當前點的座標值,為相對值*/

oldx = lohword(lparam);

oldy = hihword(lparam);

fngui_setcapture(hwnd);

iscaptured = true;

return 0;

break;

case msg_mousemove:

}break;

case msg_lbuttonup:

/*釋放滑鼠*/

oldx = oldy = 0;

x = y = 0;

fngui_releasecapture();

iscaptured = false;

return 0;

break;

鍵盤訊息:當有按鍵時產生鍵盤事件,形成鍵盤訊息傳遞給視窗過程,傳送過程採取的是一種由頂向下的方式,從桌面到啟用主視窗再到其上的焦點控制項。其主要的訊息有:msg_keydown  msg_char  msg_keyup msg_syskeydown  msg_syschar  msg_syskeyup,wparam 引數表示的是鍵碼,lparam 引數表示的是控制鍵如alt、shift 等的狀態。在應用程式中使用者可通過系統呼叫fngui_setactivewindow來啟用某個主視窗,同時使用者可通過系統呼叫fngui_setfocus 設定某個視窗具有焦點,fngui_killfocus 使某個視窗失去焦點。

滑鼠鍵盤學習

出現問題地方 1 label 和pushbutton上面無法顯示中文,出現亂碼 待解決 在main.cpp中已加入qtext odec setcodecfortr qtextcodec codecforlocale 2 在鍵入兩個函式 void mousemoveevent qmouseevent ...

unity學習筆記(2) 滑鼠鍵盤輸入

input.getkey 按下某鍵後,持續返回true input.getkeydown 按下某鍵的一瞬間,返回true input.getkeyup 抬起某鍵的一瞬間,返回true返回值 bool型別 引數 keycode列舉 enum keycode 鍵碼,儲存了物理鍵盤按鍵 索引碼 void ...

JS基礎內容小結(event 滑鼠鍵盤事件)(三)

var ev ev event 相容性處理 得到焦點為 onfocus 失去焦點 onblur return false能阻止部分函式的執行 obj.select 選擇指定元素裡的文字內容 待了解 odiv.style.width swleff ev.clientx px odiv.style.le...