rasim Posted January 25, 2008 Posted January 25, 2008 (edited) Hi! How correctly delete zero column? I see in the help file this remark: If you must delete column zero, insert a zero length dummy column zero, and delete column one and aboveBut i don`t know how? expandcollapse popup#include <GuiListView.au3> #include <GuiImageList.au3> #include <GuiConstantsEx.au3> $Gui = GUICreate("Test", 300, 200) $hListView = _GUICtrlListView_Create($GUI, "Items|SubItems1|SubItems2", 20, 15, 260, 170, BitOR($LVS_EDITLABELS, $LVS_REPORT), $WS_EX_CLIENTEDGE) $hImage = _GUIImageList_Create (16,16,5); _GUIImageList_AddIcon ($hImage, "shell32.dll", 3); _GUIImageList_AddIcon ($hImage, "shell32.dll", 11); _GUIImageList_AddIcon ($hImage, "shell32.dll", 22); _GUIImageList_AddIcon ($hImage, "shell32.dll", 33); _GUICtrlListView_SetImageList ($hListView, $hImage, 1) _GUICtrlListView_AddItem($hListView, "Item1",0) _GUICtrlListView_AddItem($hListView, "Item2",2) _GUICtrlListView_AddItem($hListView, "Item3",1) _GUICtrlListView_AddItem($hListView, "Item4",3) _GUICtrlListView_AddSubItem ($hListView, 0,'44', 1) _GUICtrlListView_AddSubItem ($hListView, 1,'22', 1) _GUICtrlListView_AddSubItem ($hListView, 2,'11', 1) _GUICtrlListView_AddSubItem ($hListView, 3,'33', 1) _GUICtrlListView_AddSubItem ($hListView, 0,'New', 2) _GUICtrlListView_AddSubItem ($hListView, 1,'Page', 2) _GUICtrlListView_AddSubItem ($hListView, 2,'Sys', 2) _GUICtrlListView_AddSubItem ($hListView, 3,'Device', 2) GUISetState() GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd Func DelColumn($cIndex) _GUICtrlListView_DeleteColumn($hListView, $cIndex) _GUICtrlListView_InsertColumn($hListView, $cIndex, "Inserted") EndFunc ;------------------------------------------------------------------------------ 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_COLUMNCLICK Local $tInfo = DllStructCreate($tagNMLISTVIEW, $ilParam) Local $ColumnIndex = DllStructGetData($tInfo, "SubItem") DelColumn($ColumnIndex) EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc Edited January 25, 2008 by rasim
rasim Posted January 25, 2008 Author Posted January 25, 2008 (edited) I`m seem i found a solution:Func DelColumn($cIndex) If $cIndex = 0 Then _GUICtrlListView_InsertColumn($hListView, 0, 0) _GUICtrlListView_DeleteColumn($hListView, $cIndex) Else _GUICtrlListView_DeleteColumn($hListView, $cIndex) _GUICtrlListView_InsertColumn($hListView, $cIndex, "SubItems") EndIf EndFuncNo Items not deleted, but set invisible. Edited January 25, 2008 by rasim
martin Posted January 25, 2008 Posted January 25, 2008 I`m seem i found a solution: Func DelColumn($cIndex) If $cIndex = 0 Then _GUICtrlListView_InsertColumn($hListView, 0, 0) _GUICtrlListView_DeleteColumn($hListView, $cIndex) Else _GUICtrlListView_DeleteColumn($hListView, $cIndex) _GUICtrlListView_InsertColumn($hListView, $cIndex, "SubItems") EndIf EndFunc No Items not deleted, but set invisible. That's not doing what you quoted in your first post, and also the third parameter should be text not zero so maybe this will work Func DelColumn($cIndex) If $cIndex = 0 Then _GUICtrlListView_InsertColumn($hListView, 0, '');<---'' was 0 _GUICtrlListView_DeleteColumn($hListView, 1);<----1 was 0 Else _GUICtrlListView_DeleteColumn($hListView, $cIndex) _GUICtrlListView_InsertColumn($hListView, $cIndex, "SubItems") EndIf EndFunc[ Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
GaryFrost Posted January 26, 2008 Posted January 26, 2008 Just delete column zero, I believe that documentation is wrong. SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
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