FireLordZi Posted January 31, 2008 Share Posted January 31, 2008 How do I store all the items that are in my third column into an array so after I delete every item in the listview I can reload the items like they were never deleted? While Alive() { DrinkWine(); }AutoIt Programmer Link to comment Share on other sites More sharing options...
Uriziel01 Posted January 31, 2008 Share Posted January 31, 2008 Sorry but.... i dont undestand what do you want to get ? You want to keep only third column of listview, and when you erase whole listview you want to reload only the data from 3 column? Im right?? Link to comment Share on other sites More sharing options...
FireLordZi Posted January 31, 2008 Author Share Posted January 31, 2008 Correct. While Alive() { DrinkWine(); }AutoIt Programmer Link to comment Share on other sites More sharing options...
Uriziel01 Posted January 31, 2008 Share Posted January 31, 2008 (edited) It will be hard to make without any cells selected.... hmmm... sory but i think i coud not help But i will try and when i'll get something i'll post it. Edited January 31, 2008 by Uriziel01 Link to comment Share on other sites More sharing options...
FireLordZi Posted January 31, 2008 Author Share Posted January 31, 2008 my listview isn't multi-select anyway. i was thinking it could be done in a for next loop and store in an array with however many items are in the 3rd listview column, then delete all items in listview, and after that reload the items back into the thrid column. While Alive() { DrinkWine(); }AutoIt Programmer Link to comment Share on other sites More sharing options...
Uriziel01 Posted January 31, 2008 Share Posted January 31, 2008 This will not be better ?? _GUICtrlListView_DeleteColumn($ListView, 0) _GUICtrlListView_DeleteColumn($ListView, 1) It will delete only 2 from 3 columns Link to comment Share on other sites More sharing options...
FireLordZi Posted January 31, 2008 Author Share Posted January 31, 2008 This will not be better ?? _GUICtrlListView_DeleteColumn($ListView, 0) _GUICtrlListView_DeleteColumn($ListView, 1) It will delete only 2 from 3 columns Too bad I don't have the latest version. I already thought of that and I can't. I can't upgrade either until I finish the script I'm workng on.... While Alive() { DrinkWine(); }AutoIt Programmer Link to comment Share on other sites More sharing options...
Uriziel01 Posted January 31, 2008 Share Posted January 31, 2008 (edited) somebody have idea why GUICtrlSetState ( controlID, $GUI_CHECKED ) dont work on ListViewItem ?? Some new bug in new version ? Or meaby im doing something wrong ?SciTe help says "$GUI_CHECKED Radio, Checkbox or ListViewItem will be checked. "p.s-but can't you add only UDF #include <GuiListView.au3> from new version ? Edited January 31, 2008 by Uriziel01 Link to comment Share on other sites More sharing options...
FireLordZi Posted January 31, 2008 Author Share Posted January 31, 2008 somebody have idea why GUICtrlSetState ( controlID, $GUI_CHECKED ) dont work on ListViewItem ?? Some new bug in new version ? Or meaby im doing something wrong ?SciTe help says "$GUI_CHECKED Radio, Checkbox or ListViewItem will be checked. "p.s-but can't you add only UDF #include <GuiListView.au3> from new version ?You probably need to start your own thread next time for a question totally different from my topic. While Alive() { DrinkWine(); }AutoIt Programmer Link to comment Share on other sites More sharing options...
rover Posted February 1, 2008 Share Posted February 1, 2008 (edited) would it not be preferable to store items to be entered in third column into an array at time of data entry? anyway here's an example of reading third column items into an array expandcollapse popup#include <GUIConstantsEx.au3> Local $listview, $msg, $i = 1, $iflag = 0 Dim $aItem[1], $aCol3[1] Dim $lvitem[5]=["item1|col12|col13","item2|col22|col23", _ "item3|col32|col33","item4|col42|col43","item5|col52|col53"] GUICreate("listview items", 220, 250, 100, 200) $listview = GUICtrlCreateListView("col1 |col2|col3 ", 10, 10, 200, 150) For $element In $lvitem $aSize = UBound($aItem) Switch $iflag Case 0 $iflag = 1 Case 1 $aSize += 1 ReDim $aItem[$aSize] EndSwitch $aItem[$aSize-1] = GUICtrlCreateListViewItem($element, $listview) Next GUISetState() For $element In $aItem GUICtrlSetState($element, $GUI_FOCUS) ; to answer the 'thread hijacking' question, the item must be focused first then read (or checked) Local $aArray = StringSplit(GUICtrlRead(GUICtrlRead($listview)),"|") ReDim $aCol3[$i] $aCol3[$i-1] = $aArray[$aArray[0]] ; changed from fixed $aArray[3] to $aArray[$aArray[0]] for last column $i += 1 Next For $element In $aCol3 ; array contains third column items ConsoleWrite($element&@LF) Next Do $msg = GUIGetMsg() Until $msg = $GUI_EVENT_CLOSE Exit Edited February 1, 2008 by rover I see fascists... Link to comment Share on other sites More sharing options...
FireLordZi Posted February 1, 2008 Author Share Posted February 1, 2008 (edited) So what is $lvitem anyway? Is it the listview items? If so, can I use my ini to represent it instead of a bunch of arrays? Edit: Nvm, I'm having tons of problems with it Edited February 1, 2008 by FireLordZi While Alive() { DrinkWine(); }AutoIt Programmer Link to comment Share on other sites More sharing options...
rover Posted February 1, 2008 Share Posted February 1, 2008 (edited) So what is $lvitem anyway? Is it the listview items? If so, can I use my ini to represent it instead of a bunch of arrays? Edit: Nvm, I'm having tons of problems with it $lvitem array is used for an example of control creation on the fly to allow adding listview items as needed and storing the control ids in an array. you can remove the 'For $element In $lvitem' loop and call the code inside it in a function and replace '$element' with your iniread contents pseudocode Global $iflag = 0 ; would be your variable with string elements assembled from ini file with '|' delimiter $var = "item1|col12|col13" _AddLVItem($var) Func _AddLVItem($item) Local $aSize = UBound($aItem) Switch $iflag ; prevents redimming array when size is one element Case 0 $iflag = 1 Case 1 $aSize += 1 ReDim $aItem[$aSize] EndSwitch $aItem[$aSize-1] = GUICtrlCreateListViewItem($item, $listview) EndFunc Edited February 1, 2008 by rover I see fascists... Link to comment Share on other sites More sharing options...
rasim Posted February 1, 2008 Share Posted February 1, 2008 somebody have idea why GUICtrlSetState ( controlID, $GUI_CHECKED ) dont work on ListViewItem ?? Some new bug in new version ? Or meaby im doing something wrong ? SciTe help says "$GUI_CHECKED Radio, Checkbox or ListViewItem will be checked. " p.s-but can't you add only UDF #include <GuiListView.au3> from new version ? From help file State of a "listviewitem" control can be changed if the associated "listview" control has been created with an extended style $LVS_EX_CHECKBOXES Example: expandcollapse popup#include <GuiConstants.au3> Global $aLV_Items[11] $aLV_Items[0] = 10 $Gui = GUICreate("Test", 300, 200) $ListView = GUICtrlCreateListView("Items ", 20, 15, 260, 150, BitOR($LVS_EDITLABELS, $LVS_REPORT), $LVS_EX_CHECKBOXES + $WS_EX_CLIENTEDGE) For $i = 1 To $aLV_Items[0] $aLV_Items[$i] = GUICtrlCreateListViewItem("Item" & $i, $ListView) Next $Check_Btn =GUICtrlCreateButton("Check all", 20, 170, 70, 25) GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE ExitLoop Case $Check_Btn CheckUncheck(GUICtrlRead($Check_Btn)) EndSwitch WEnd Func CheckUncheck($State) Local $Flag, $i If $State = "Check all" Then GUICtrlSetData($Check_Btn, "Uncheck all") $Flag = $GUI_CHECKED Else $Flag = $GUI_UNCHECKED GUICtrlSetData($Check_Btn, "Check all") EndIf For $i = 1 To $aLV_Items[0] GUICtrlSetState($aLV_Items[$i], $Flag) Next EndFunc 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