Search the Community
Showing results for tags 'subitem'.
-
HolĂ , I would like to understand why when I select a subitem remains the focus on it. THX ;Rootx #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <GuiStatusBar.au3> #include <ListViewConstants.au3> #include <WindowsConstants.au3> #include <Array.au3> #include <File.au3> #include <GuiImageList.au3> #include <MsgBoxConstants.au3> #include <GuiListView.au3> Global $idListview #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 615, 450, 192, 124) $Button1 = GUICtrlCreateButton("Button1", 16, 16, 75, 25) $idListview = GUICtrlCreateListView("", 16, 56, 586, 358, BitOR($GUI_SS_DEFAULT_LISTVIEW,$LVS_SORTASCENDING,$LVS_AUTOARRANGE), BitOR($WS_EX_CLIENTEDGE,$LVS_EX_GRIDLINES)) _GUICtrlListView_InsertColumn($idListview, 0, "Column 1", 100) _GUICtrlListView_InsertColumn($idListview, 1, "Column 2", 100) _GUICtrlListView_InsertColumn($idListview, 2, "Column 3", 100) _GUICtrlListView_AddItem($idListview, "Row 1: Col 1", 0) _GUICtrlListView_AddSubItem($idListview, 0, "Row 1: Col 2", 1, 1) _GUICtrlListView_AddSubItem($idListview, 0, "Row 1: Col 3", 2, 1) _GUICtrlListView_AddItem($idListview, "Row 2: Col 1", 1) _GUICtrlListView_AddSubItem($idListview, 1, "Row 2: Col 2", 1, 1) _GUICtrlListView_AddSubItem($idListview, 1, "Row 2: Col 3", 2,1) _GUICtrlListView_AddItem($idListview, "Row 3: Col 1", 2) _GUICtrlListView_AddSubItem($idListview, 2, "Row 3: Col 2",1, 1) _GUICtrlListView_AddSubItem($idListview, 2, "Row 3: Col 3",2, 1) $StatusBar1 = _GUICtrlStatusBar_Create($Form1) GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 EndSwitch WEnd Func WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $tInfo, $hWndListView = $idListview If Not IsHWnd($idListview) Then $hWndListView = GUICtrlGetHandle($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 $LVN_COLUMNCLICK Local $tInfo = DllStructCreate($tagNMITEMACTIVATE, $lParam) Local $iCol = DllStructGetData($tInfo, "SubItem") ConsoleWrite("Column clicked: " & $iCol & @CRLF) Case $NM_CLICK $aHit = _GUICtrlListView_SubItemHitTest($hWndFrom) $LVEIP_Item = $aHit[0] $LVEIP_SubItem = $aHit[1] Local $tItem $tItem = DllStructCreate($tagLVITEM) DllStructSetData($tItem, "Mask", $LVIF_STATE) DllStructSetData($tItem, "Item", $LVEIP_Item) DllStructSetData($tItem, "SubItem", $LVEIP_SubItem) DllStructSetData($tItem, "State", $LVIS_SELECTED) DllStructSetData($tItem, "StateMask", $LVIS_SELECTED) _GUICtrlListView_SetItemEx($hWndFrom, $tItem) ConsoleWrite("Selected Cell " & _GUICtrlListView_GetItemText($idListview,$LVEIP_Item,$LVEIP_SubItem)&@CRLF) EndSwitch EndSwitch EndFunc