Trax Posted October 31, 2014 Share Posted October 31, 2014 I have a Listview that I am trying to move a -1 in to. It displays as a blank. I can move a -1, -2, -3, -4, -5 to it and it displays fine. I just can't move a -1 to it. No errors. It just won't display as a -1. It displays empty. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 31, 2014 Moderators Share Posted October 31, 2014 Trax,A reproducer script would be helpful - otherwise we are just guessing. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Trax Posted November 2, 2014 Author Share Posted November 2, 2014 expandcollapse popup#Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=ArchServer.ico #AutoIt3Wrapper_Outfile=Test.exe #AutoIt3Wrapper_Res_Comment=version 3.00 compiled on #AutoIt3Wrapper_Res_Description=version 3.00 compiled on #AutoIt3Wrapper_Res_Fileversion=3 #AutoIt3Wrapper_Run_Au3Stripper=y #Au3Stripper_Parameters=/so #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** AutoItSetOption("MustDeclareVars", 1) AutoItSetOption("TCPTimeout", 100) Opt("TrayMenuMode", 1) #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> #include <Constants.au3> #include <GUIListBox.au3> #include <GUIEdit.au3> #include <GuiListView.au3> #include <Array.au3> #include <ButtonConstants.au3> #include <NamesandPaths.au3> #include <ScrollBarConstants.au3> #include <MsgBoxConstants.au3> #include <Misc.au3> #include <File.au3> #include <GuiScrollBars.au3> #include <GuiHeader.au3> ; Variables for MustDeclare Local $hServer, $sRecv, $Data, $strinstr, $sData, $sFile, $cEdit_2, $csData, $aRet Local $compName = "", $strSplit, $DateTime, $User, $CarDatabase = "Database.txt", $WriteCounter = 0 Local $MaxCars = 1000, $CarData[$MaxCars][4], $NumCars = -1, $List1, $List2, $List3, $List4 Local $GUIhandle, $hChild_1 = 9999, $ButtonCloseChild, $msg Local $iDeltaY, $Translation_Path = @ProgramFilesDir & "\ArchServer\Translation.txt" Local $cLabel_1, $cLabel_2, $cLabel_3, $srch_inputbox, $srch_inputbutton Local $LV_Find, $srch_checkbox, $in_Read Const $Ascending = 0, $Descending = 1 Local $Resort, $SortColumn = 3, $SortDirection = $Ascending ReadCars() GUI() Exit Func GUI() Local $Index, $LV1, $LV2, $LV3, $L1_EX, $L2_EX, $L3_EX $GUIhandle = GUICreate("ArchServer", 680, 575, -1, -1, $WS_SIZEBOX + $WS_SYSMENU + $WS_MAXIMIZEBOX + $WS_MINIMIZEBOX) ;creates the parent window $List1 = GUICtrlCreateListView("Computer Name ", 20, 35, 300, 448, -1, $LVS_EX_DOUBLEBUFFER) $cLabel_1 = GUICtrlCreateLabel("", 20, 35, 300, 448) GUICtrlSetState($cLabel_1, $GUI_DISABLE) GUICtrlSetResizing($cLabel_1, $GUI_DOCKAUTO) GUICtrlSetBkColor($cLabel_1, $GUI_BKCOLOR_TRANSPARENT) _GUICtrlListView_SetExtendedListViewStyle($List1, $LVS_EX_TWOCLICKACTIVATE) $List2 = GUICtrlCreateListView("Date/Time", 355, 35, 190, 450, -1, $LVS_EX_DOUBLEBUFFER) $cLabel_2 = GUICtrlCreateLabel("", 355, 35, 190, 450) GUICtrlSetState($cLabel_2, $GUI_DISABLE) GUICtrlSetResizing($cLabel_2, $GUI_DOCKAUTO) GUICtrlSetBkColor($cLabel_2, $GUI_BKCOLOR_TRANSPARENT) $List3 = GUICtrlCreateListView("RPM", 574, 35, 95, 450, -1, $LVS_EX_DOUBLEBUFFER) $cLabel_3 = GUICtrlCreateLabel("", 574, 35, 95, 450) GUICtrlSetState($cLabel_3, $GUI_DISABLE) GUICtrlSetResizing($cLabel_3, $GUI_DOCKAUTO) GUICtrlSetBkColor($cLabel_3, $GUI_BKCOLOR_TRANSPARENT) GUICtrlCreateLabel("Additional Info", 20, 489) ;creates the label for $List4 GUICtrlSetResizing(-1, $GUI_DOCKSIZE) $List4 = GUICtrlCreateList("", 20, 512, 635, 40, BitOR($WS_BORDER, $WS_VSCROLL), $ES_READONLY) GUICtrlSetResizing($List4, $GUI_DOCKAUTO) $srch_inputbox = GUICtrlCreateInput("Enter comp name", 19, 5, 130, 20) GUICtrlSetResizing(-1, $GUI_DOCKAUTO) $srch_inputbutton = GUICtrlCreateButton("Search", 160, 5, -1, 20) GUICtrlSetResizing(-1, $GUI_DOCKAUTO) $srch_checkbox = GUICtrlCreateCheckbox("Partial Match", 210, 5) GUISetState(@SW_SHOW) ;shows the GUI window MsgBox(0, "", "GUI Opened") For $Index = 0 To $NumCars _GUICtrlListView_AddItem($List1, "") ;adds a default value into $List1 _GUICtrlListView_AddItem($List2, "") ;adds a default value into $List2 _GUICtrlListView_AddItem($List3, "") ;adds a default value into $List3 Next MsgBox(0, "", "GUI Filled") For $Index = 0 to $NumCars _GUICtrlListView_SetItem($List1, $CarData[$Index][0], $Index) _GUICtrlListView_SetItem($List2, $CarData[$Index][1], $Index) _GUICtrlListView_SetItem($List3, $CarData[$Index][2], $Index) Next MsgBox(0, "", "GUI DOne") EndFunc ;==>GUI Func ReadCars() Local $Index $NumCars = 50 For $Index = 0 To $NumCars $CarData[$Index][0] = "Computer Number " & $Index $CarData[$Index][1] = "11/02/2014 @ 1:00pm" $CarData[$Index][2] = $Index If $Index < 10 Then $carData[$Index][2] = -1 * $carData[$Index][2] EndIf Next EndFunc Here you go. I am bug eyed. I spent all weekend on this and got nowhere. I even tried putting a direct "-1" in rather then a variable and it still displayed as blank. I am doing something really stupid. I just don't see it. Thanks! Link to comment Share on other sites More sharing options...
Moderators Solution Melba23 Posted November 2, 2014 Moderators Solution Share Posted November 2, 2014 TraxFrom the Help file for _GUICtrlListView_SetItem: If a notification callback is needed, you have to specify $sText = -1So it looks as if setting the $sText parameter to -1 in that function is a special case and so will not be honoured. But why are you using that function in the first place? It is designed to alter the item attributes which is not what you are doing. So why not just set the values directly?For $Index = 0 To $NumCars _GUICtrlListView_AddItem($List1, $CarData[$Index][0]) _GUICtrlListView_AddItem($List2, $CarData[$Index][1]) _GUICtrlListView_AddItem($List3, $CarData[$Index][2]) Next MsgBox(0, "", "GUI Filled") ; For $Index = 0 To $NumCars ; _GUICtrlListView_SetItem($List1, $CarData[$Index][0], $Index) ; _GUICtrlListView_SetItem($List2, $CarData[$Index][1], $Index) ; _GUICtrlListView_SetItem($List3, $CarData[$Index][2], $Index) ; Next MsgBox(0, "", "GUI DOne")You are doing nothing more in your second loop. And why on earth are you setting the items 1-9 to negative values anyway? M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Trax Posted November 2, 2014 Author Share Posted November 2, 2014 I reworked the original code to make is as short as possible for posting. I don't AddItem and SetIitem back to back as displayed above. I AddItems there and throughout the program use SetItem to update it as needed. I need a flag to specify that the RPM has not been retreived yet. A -1 seemed to be a good flag for that. The -2 thru -9 were just used to show that other negitive numbers could be put in that list. Since -1 isn't allowed I'll change the flag to -99 Thanks! Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted November 4, 2014 Share Posted November 4, 2014 Why don't you try _GUICtrlListView_SetItemText() if you are only changing the text anyway? .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface 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