Jikoo Posted October 29, 2008 Share Posted October 29, 2008 (edited) Hello,Is it possible to select and unselect an item of listview with $LVS_NOCOLUMNHEADER ?... because without it, it works !Thank youI use the AutoIt version : 3.2.12.1#include <GuiListView.au3> #include <GuiImageList.au3> $gui = GUICreate('Test ListView select-unselect', 300, 200) $glList = GUICtrlCreateListView('Column ', 0, 0, 300, 160, $LVS_NOCOLUMNHEADER) $b1 = GUICtrlCreateButton('Select', 20, 170) $b2 = GUICtrlCreateButton('Unselect', 70, 170) $hImage = _GUIImageList_Create(16, 16, 5, 3) _GUIImageList_AddIcon($hImage, "shell32.dll", 3) _GUIImageList_AddIcon($hImage, "shell32.dll", 1) _GUIImageList_AddIcon($hImage, "shell32.dll", 11) _GUICtrlListView_SetImageList($glList, $hImage, 1) _GUICtrlListView_AddItem($glList, "Item0", 0) _GUICtrlListView_AddItem($glList, "Item1", 1) _GUICtrlListView_AddItem($glList, "Item2", 2) GUISetState() While 1 Sleep(10) Switch GUIGetMsg() Case - 3 Exit Case $b1 _GUICtrlListView_SetItemSelected($glList, 1, True) Case $b2 _GUICtrlListView_SetItemSelected($glList, 1, False) EndSwitch WEnd Edited October 30, 2008 by Jikoo My projects : GCS Search 1.07 (GUI Control Styles Search)* Multilingual tool to help about the old scripts, with a dynamic menu.* Easy way to find missing Include files in old scripts downloaded from forums !* Famous Monoceres script added and improved (visual, drag and drop, automatic)* There is an interactive color converter with palettes too, for fun !The best way to start Autoit3 development (for newbies). Link to comment Share on other sites More sharing options...
rasim Posted October 29, 2008 Share Posted October 29, 2008 JikooUse a $LVS_SHOWSELALWAYS style:#include <GuiListView.au3> #include <GuiImageList.au3> $gui = GUICreate('Test ListView select-unselect', 300, 200) $glList = GUICtrlCreateListView('Column ', 0, 0, 300, 160, BitOR($LVS_SHOWSELALWAYS, $LVS_NOCOLUMNHEADER)) $b1 = GUICtrlCreateButton('Select', 20, 170) $b2 = GUICtrlCreateButton('Unselect', 70, 170) $hImage = _GUIImageList_Create(16, 16, 5, 3) _GUIImageList_AddIcon($hImage, "shell32.dll", 3) _GUIImageList_AddIcon($hImage, "shell32.dll", 1) _GUIImageList_AddIcon($hImage, "shell32.dll", 11) _GUICtrlListView_SetImageList($glList, $hImage, 1) _GUICtrlListView_AddItem($glList, "Item0", 0) _GUICtrlListView_AddItem($glList, "Item1", 1) _GUICtrlListView_AddItem($glList, "Item2", 2) GUISetState() While 1 Sleep(10) Switch GUIGetMsg() Case - 3 Exit Case $b1 _GUICtrlListView_SetItemSelected($glList, 1, True, True) Case $b2 _GUICtrlListView_SetItemSelected($glList, 1, False) EndSwitch WEnd hudsonhock 1 Link to comment Share on other sites More sharing options...
Jikoo Posted October 29, 2008 Author Share Posted October 29, 2008 One more time, thank you very much rasim, You are everywhere ! My projects : GCS Search 1.07 (GUI Control Styles Search)* Multilingual tool to help about the old scripts, with a dynamic menu.* Easy way to find missing Include files in old scripts downloaded from forums !* Famous Monoceres script added and improved (visual, drag and drop, automatic)* There is an interactive color converter with palettes too, for fun !The best way to start Autoit3 development (for newbies). Link to comment Share on other sites More sharing options...
Zedna Posted October 29, 2008 Share Posted October 29, 2008 rasim is right but I will add more detailed GENERAL explanation here: ListView (and also other controls) has some default styles even if you don't explicitly define them in GUICtrlCreate... When you wan't to add some new style (to combine styles with the default style) you should use: BitOr($GUI_SS_DEFAULT_LISTVIEW, newstyle,...) here in your case: $glList = GUICtrlCreateListView('Column ', 0, 0, 300, 160, BitOr($GUI_SS_DEFAULT_LISTVIEW, $LVS_NOCOLUMNHEADER)) if you use only your new style then all default styles are not used ("are destroyed"): $glList = GUICtrlCreateListView('Column ', 0, 0, 300, 160, $LVS_NOCOLUMNHEADER) Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Jikoo Posted October 29, 2008 Author Share Posted October 29, 2008 Thank you Zedna for your explanation. It's clear. My projects : GCS Search 1.07 (GUI Control Styles Search)* Multilingual tool to help about the old scripts, with a dynamic menu.* Easy way to find missing Include files in old scripts downloaded from forums !* Famous Monoceres script added and improved (visual, drag and drop, automatic)* There is an interactive color converter with palettes too, for fun !The best way to start Autoit3 development (for newbies). Link to comment Share on other sites More sharing options...
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