vicbox777
Junior Member | Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору
Код: #include <GuiConstantsEx.au3> #include <AVIConstants.au3> #include <TreeViewConstants.au3> #include <Constants.au3> #include <GUIListBox.au3> #include <WindowsConstants.au3> ; GUI GuiCreate("Пример", 130, 130) ; LIST Global $ggg = GuiCtrlCreateList("",5, 5, 120, 120) GuiCtrlSetData(-1, "1 Sample|2 Sample|3 Sample|4 Sample") GuiSetState() GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") ; GUI MESSAGE LOOP GuiSetState() While 1 $msg = GuiGetMsg() If $msg = $GUI_EVENT_CLOSE Then Exit ;~ If $msg = $ggg Then ;~ $gggg = GUICtrlRead($ggg) ;~ MsgBox(0, "", $gggg) ;~ EndIf WEnd Func WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg Local $hWndFrom, $iIDFrom, $iCode, $hWndListBox If Not IsHWnd($ggg) Then $hWndListBox = GUICtrlGetHandle($ggg) $hWndFrom = $ilParam $iIDFrom = BitAND($iwParam, 0xFFFF) ; Low Word $iCode = BitShift($iwParam, 16) ; Hi Word Switch $hWndFrom Case $hWndListBox Switch $iCode Case $LBN_DBLCLK ; Sent when the user double-clicks a string in a list box _DebugPrint("$LBN_DBLCLK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _ "-->Code:" & @TAB & $iCode) ; no return value MsgBox(64, "--> hWndFrom:" & $hWndFrom, "$LBN_DBLCLK") Case $LBN_ERRSPACE ; Sent when a list box cannot allocate enough memory to meet a specific request _DebugPrint("$LBN_ERRSPACE" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _ "-->Code:" & @TAB & $iCode) ; no return value Case $LBN_KILLFOCUS ; Sent when a list box loses the keyboard focus _DebugPrint("$LBN_KILLFOCUS" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _ "-->Code:" & @TAB & $iCode) ; no return value Case $LBN_SELCANCEL ; Sent when the user cancels the selection in a list box _DebugPrint("$LBN_SELCANCEL" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _ "-->Code:" & @TAB & $iCode) ; no return value Case $LBN_SELCHANGE ; Sent when the selection in a list box has changed _DebugPrint("$LBN_SELCHANGE" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _ "-->Code:" & @TAB & $iCode) ; no return value Case $LBN_SETFOCUS ; Sent when a list box receives the keyboard focus _DebugPrint("$LBN_SETFOCUS" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _ "-->Code:" & @TAB & $iCode) ; no return value EndSwitch EndSwitch ; Proceed the default Autoit3 internal message commands. ; You also can complete let the line out. ; !!! But only 'Return' (without any value) will not proceed ; the default Autoit3-message in the future !!! Return $GUI_RUNDEFMSG EndFunc ;==>WM_COMMAND Func _DebugPrint($s_text) $s_text = StringReplace($s_text, @LF, @LF & "-->") ConsoleWrite("!===========================================================" & @LF & _ "+===========================================================" & @LF & _ "-->" & $s_text & @LF & _ "+===========================================================" & @LF) EndFunc ;==>_DebugPrint |
| Всего записей: 165 | Зарегистр. 17-06-2008 | Отправлено: 13:01 24-07-2009 | Исправлено: vicbox777, 13:04 24-07-2009 |
|