lupusbalo Posted January 28, 2006 Posted January 28, 2006 I'am writing my first complex GUI application, and most of the coding and testing goes well, except for one specific windowIn this one I have a Listview which I want to populate with data coming from a file.Each "line" of the file is an "item" of the list, formated like "valuecol1 | valuecol2 | etc..."I used _FileReadToArray() UDF and the resulting array displays well using _ArrayDisplay()I tried many different codings but My GUICtrlCreateListViewItem(...) desperately produce an ERROR IN ExpressionSo starting from the "ControlCreateListViewItem()" example in the help file, I put my own code in This gives the same bad result!!!!!I should be wrong somewhere obviously but can't understand where!!!here is the update exempleexpandcollapse popup; ##### original code comes from help file (GuiCtrlCreateListViewItem example) #include <GUIConstants.au3> #include <file.au3> ; ## added to original example to make additional code work #include <array.au3> ; ## added to original example to make additional code work GUICreate("listview items",220,250, 100,200,-1,$WS_EX_ACCEPTFILES) GUISetBkColor (0x00E0FFFF) ; will change background color $listview = GuiCtrlCreateListView ("col1 |col2|col3 ",10,10,200,150,$LVS_SORTDESCENDING) $button = GuiCtrlCreateButton ("Value?",75,170,70,20) $item1=GuiCtrlCreateListViewItem("item2|col22|col23",$listview) $item2=GuiCtrlCreateListViewItem("............item1|col12|col13",$listview) $item3=GuiCtrlCreateListViewItem("item3|col32|col33",$listview) $input1=GuiCtrlCreateInput("",20,200, 150) GuiCtrlSetState(-1,$GUI_DROPACCEPTED) ; to allow drag and dropping GuiSetState() GUICtrlSetData($item2,"|ITEM1") GUICtrlSetData($item3,"||COL33") GUICtrlDelete($item1) ;######### HERE starts my own code ###### Local $MyFile="E:\ClubInfo\## Technique\Outils controle\CIVSM Gestion New\exemple filelistviewitem.txt" #cs HERE is the File as viewed with Scite: Mr|Nom_1|prénom_1 Mme|Nom_2|prénom_2 Mr|Nom_3|prénom_3 Mr|Nom_4|prénom_4 Mr|Nom_5|prénom_5 #ce Dim $MyData[150] _FileReadToArray($MyFile,$MyData) ; Import My Data from My File (works fine _ArrayDisplay($MyData,"My Data") ; displays correctly For $i=1 to $MyData[0] GuiCtrlCreateListViewItem($MyData($i),$listview) [b]; Here i get an ERROR IN Exp[b][/b]ression[/b] Next ; ###### HERE Ends my own code ###### GUISetState(@SW_SHOW) Do $msg = GuiGetMsg () Select Case $msg = $button MsgBox(0,"listview item",GUICtrlRead(GUICtrlRead($listview)),2) Case $msg = $listview MsgBox(0,"listview", "clicked="& GuiCtrlGetState($listview),2) EndSelect Until $msg = $GUI_EVENT_CLOSEHELP!!LupusBalo
lupusbalo Posted January 28, 2006 Author Posted January 28, 2006 $MyData($i) is $MyData[$i] 8) YES!!!! I knew it was probably something stupid like that. reading re-reading & re-re-re.....I finally found it!! You sjust beat me "on the line" I went to ""clear"" my stupid post when i see your "quick & brilliant" answer THX anyway This Forum is definitely well-visited Lupusbalo
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