Search the Community
Showing results for tags '$LVS_EX_GRIDLINES'.
-
Happy New year to all. when I run the program without using $LVS_EX_GRIDLINES I get the Index and the subitem values correctly. when I run the program using $LVS_EX_GRIDLINES I get the Index always = -1 and the subitem values are correct. What do I need to do to get the correct index and subitem using the gridlines? right click a sub item to view in Console. REB #Region - Includes #include <GUIConstantsEx.au3> #include <GuiListView.au3> #include <WindowsConstants.au3> #include <ListViewConstants.au3> #EndRegion - Includes #Region - Variables Local $width = @DesktopWidth, $wheight = @DesktopHeight - 30, $COLOR_GUI = 0xFFFFFF, $lvtop = 100, $index, $subitem #Region -Create GUI GUICreate("Test WM_NOTIFY()", $width, $wheight - 150, 0, 0) ;@DesktopWidth, @DesktopHeight, 0, 0) ; GUISetBkColor(0xF0F4F9) ; $COLOR_GUI) GUISetState() #EndRegion -Create GUI GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") #Region - Create Listview $g_idListView = GUICtrlCreateListView("", 0, $lvtop, $width, $wheight - $lvtop - 150, $LVS_REPORT, $LVS_EX_GRIDLINES) ;~ $g_idListView = GUICtrlCreateListView("", 0, $lvtop, $width, $wheight - $lvtop - 50, $LVS_REPORT) #Region - Add Columns ; Add columns _GUICtrlListView_InsertColumn($g_idListView, 0, 0, 30) For $i = 1 To 15 Step 3 _GUICtrlListView_InsertColumn($g_idListView, $i, "TOTAL = 100", 105 + 31) _GUICtrlListView_InsertColumn($g_idListView, $i + 2, "PHASE", 65) _GUICtrlListView_InsertColumn($g_idListView, $i + 3, "", 22) Next _GUICtrlListView_InsertColumn($g_idListView, $i, "TOTAL =", 105 + 31) _GUICtrlListView_InsertColumn($g_idListView, $i + 2, "PHASE", 65) GUICtrlSetFont($g_idListView, 13, 700, Default, "Courier New", 4) ;~ GUICtrlSetState($g_idListView, $GUI_SHOW) For $i = 1 To 50 _GUICtrlListView_AddItem($g_idListView, $i, 0) Next Local $jump = -2 For $i = 1 To 6 $jump = $jump + 3 _GUICtrlListView_SetItem($g_idListView, " 100", 0, $jump) _GUICtrlListView_SetItem($g_idListView, 1, 0, $jump + 1) Next #EndRegion - Add Columns #EndRegion - Create Listview #Region - Loop Do $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE, $idOK ExitLoop EndSwitch Until $msg = $GUI_EVENT_CLOSE #EndRegion - Loop GUIDelete() Func WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam, $index, $subitem Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView, $tInfo $hWndListView = $g_idListView If Not IsHWnd($g_idListView) Then $hWndListView = GUICtrlGetHandle($g_idListView) $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hWndListView Switch $iCode Case $NM_RCLICK ; Sent by a list-view control when the user clicks an item with the right mouse button $tInfo = DllStructCreate($tagNMITEMACTIVATE, $lParam) $index = DllStructGetData($tInfo, "Index") ;& @CRLF & _ $subitem = DllStructGetData($tInfo, "SubItem") ;& @CRLF & _ EndSwitch ConsoleWrite("Index = " & $index & @CRLF) ConsoleWrite("subitem = " & $subitem & @CRLF) EndSwitch EndFunc ;==>WM_NOTIFY