ZwinnyRolnik Posted June 27, 2010 Posted June 27, 2010 How can i know when listview scrollbar was clicked? or arrow? Anyone know it? Please write =]
Authenticity Posted June 27, 2010 Posted June 27, 2010 From the _GUICtrlListView_Create function example. Read MSDN about the notifications to understand the parameters meaning.expandcollapse popup#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 #include <GuiConstantsEx.au3> #include <GuiListView.au3> #include <GuiImageList.au3> #include <WindowsConstants.au3> Opt('MustDeclareVars', 1) Opt('ExpandVarStrings', 1) $Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work Global $hListView _Main() Func _Main() Local $GUI, $hImage $GUI = GUICreate("(UDF Created) ListView Create", 400, 300) $hListView = _GUICtrlListView_Create($GUI, "", 2, 2, 394, 268) _GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES)) GUISetState() GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") ; Load images $hImage = _GUIImageList_Create() _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0xFF0000, 16, 16)) _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x00FF00, 16, 16)) _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x0000FF, 16, 16)) _GUICtrlListView_SetImageList($hListView, $hImage, 1) ; Add columns _GUICtrlListView_InsertColumn($hListView, 0, "Column 1", 100) _GUICtrlListView_InsertColumn($hListView, 1, "Column 2", 100) _GUICtrlListView_InsertColumn($hListView, 2, "Column 3", 100) ; Add items _GUICtrlListView_BeginUpdate($hListView) Local $iIndex For $i = 1 To 50 $iIndex = _GUICtrlListView_AddItem($hListView, "Row $i$: Col 1", 0) _GUICtrlListView_AddSubItem($hListView, $iIndex, "Row $i$: Col 2", 1, 1) _GUICtrlListView_AddSubItem($hListView, $iIndex, "Row $i$: Col 3", 2, 2) Next _GUICtrlListView_EndUpdate($hListView) ; Loop until user exits Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>_Main Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg, $iwParam Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView, $tInfo ;~ Local $tBuffer $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_BEGINSCROLL ; A scrolling operation starts, Minium OS WinXP $tInfo = DllStructCreate($tagNMLVSCROLL, $ilParam) _DebugPrint("$LVN_BEGINSCROLL" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _ "-->Code:" & @TAB & $iCode & @LF & _ "-->DX:" & @TAB & DllStructGetData($tInfo, "DX") & @LF & _ "-->DY:" & @TAB & DllStructGetData($tInfo, "DY")) Case $LVN_ENDSCROLL ; A scrolling operation ends, Minium OS WinXP $tInfo = DllStructCreate($tagNMLVSCROLL, $ilParam) _DebugPrint("$LVN_ENDSCROLL" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _ "-->Code:" & @TAB & $iCode & @LF & _ "-->DX:" & @TAB & DllStructGetData($tInfo, "DX") & @LF & _ "-->DY:" & @TAB & DllStructGetData($tInfo, "DY")) EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY Func _DebugPrint($s_text, $line = @ScriptLineNumber) ConsoleWrite( _ "!===========================================================" & @LF & _ "+======================================================" & @LF & _ "-->Line(" & StringFormat("%04d", $line) & "):" & @TAB & $s_text & @LF & _ "+======================================================" & @LF) EndFunc ;==>_DebugPrint
ZwinnyRolnik Posted June 27, 2010 Author Posted June 27, 2010 Wow really great example... Thank You :*
ZwinnyRolnik Posted June 27, 2010 Author Posted June 27, 2010 (edited) There is another problem, because when I click on the scroll bar I want to switch off wm_notify, I mean: GUIRegisterMsg($WM_NOTIFY,"") ...and when i unclick scroll bar then wm_notify turns on ... It is possible? All because of that: when I scroll the list it jams and it is wm_notify fault. Edited June 28, 2010 by ZwinnyRolnik
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now