Must AutoIt
Сообщения: 3054
Благодарности: 1009
|
Профиль
|
Сайт
|
Отправить PM
| Цитировать
Цитата andr_mozg:
необходимо проверять что выбран какойто элемент »
|
Тут Case'ом не обойтись.
Нужно делать так:
Код:
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GUIListView.au3>
Global $bItemChanged = False
$hGUI = GUICreate("(Internal) ListView Get Item Text", 400, 300)
$hListView = _GUICtrlListView_Create($hGUI, "Items", 2, 2, 394, 268)
_GUICtrlListView_InsertItem($hListView, "Item 1")
_GUICtrlListView_InsertItem($hListView, "Item 2")
_GUICtrlListView_InsertItem($hListView, "Item 3")
GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
GUISetState()
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
If $bItemChanged Then
$bItemChanged = False
$iIndx = _GUICtrlListView_GetSelectedIndices($hListView)
ConsoleWrite('Item changed: ' & _GUICtrlListView_GetItemText($hListView, Number($iIndx)) & @LF)
EndIf
WEnd
Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView
$hWndListView = $hListView
If Not IsHWnd($hListView) Then $hWndListView = GUICtrlGetHandle($hListView)
$tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
$hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
$iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
$iCode = DllStructGetData($tNMHDR, "Code")
Switch $hWndFrom
Case $hWndListView
Switch $iCode
Case $LVN_HOTTRACK; Sent by a list-view control when the user moves the mouse over an item
Case $LVN_ITEMCHANGED, $NM_CLICK ; An item has changed/clicked
$bItemChanged = True
Case $LVN_ITEMCHANGING; An item is changing
;Return True; prevent the change
;Return False; allow the change
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc
|
-------
“Сделай так просто, как возможно, но не проще этого.”... “Ты никогда не решишь проблему, если будешь думать так же, как те, кто её создал.” Альберт Эйнштейн
P.S «Не оказываю техподдержку через ПМ/ICQ, и по email - для этого есть форум. ©»
http://creator-lab.ucoz.ru/Images/Icons/autoit_icon.png Русское сообщество AutoIt | http://creator-lab.ucoz.ru/Images/Ic...eator_icon.png CreatoR's Lab | http://creator-lab.ucoz.ru/Images/Icons/oac_icon.png Opera AC Community
Отправлено: 13:42, 15-03-2011
| #2
|