gleem Posted July 7, 2006 Share Posted July 7, 2006 In the example code: ; LIST VIEW $listView = GuiCtrlCreateListView("Sample|ListView|", 110, 190, 110, 80) GuiCtrlCreateListViewItem("A|One", $listView) GuiCtrlCreateListViewItem("B|Two", $listView) GuiCtrlCreateListViewItem("C|Three", $listView) two things I want to do. First, I am pulling data from a text file in which gets updated every so often. is there a way for me to clear the current listviewitems data without exiting the program? 2nd, how can I sort the listview items by clicking on the colum headers? for example: List A | List B |List C ----------------------- 1 2 3 4 5 6 2 4 9 lets say I want to sort list A so it displays lowest to highest number? same with list b, c, etc.... Link to comment Share on other sites More sharing options...
GaryFrost Posted July 7, 2006 Share Posted July 7, 2006 Beta 1. _GUICtrlListViewDeleteAllItems 2. _GUICtrlListViewSort or GUICtrlRegisterListViewSort function SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
gleem Posted July 7, 2006 Author Share Posted July 7, 2006 Beta1. _GUICtrlListViewDeleteAllItems2. _GUICtrlListViewSort or GUICtrlRegisterListViewSort functionfor these functions.... what do I need to load these functions.... #guilist.au3? or something like that? Link to comment Share on other sites More sharing options...
Skruge Posted July 7, 2006 Share Posted July 7, 2006 (edited) for these functions.... what do I need to load these functions.... #guilist.au3? or something like that?If you look in the beta help file, you'll see that they're defined in GuiListView.au3 Edit: I wasn't sure if your question was of syntax, or of file identification. Try this:#include <GuiListView.au3> Edited July 7, 2006 by Skruge [font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font] Link to comment Share on other sites More sharing options...
gleem Posted July 7, 2006 Author Share Posted July 7, 2006 If you look in the beta help file, you'll see that they're defined in GuiListView.au3 Edit: I wasn't sure if your question was of syntax, or of file identification. Try this:#include <GuiListView.au3> when using _GuiCtrlListViewDeleteAllItems I get an error parsing function call. I am running in beta. Link to comment Share on other sites More sharing options...
GaryFrost Posted July 7, 2006 Share Posted July 7, 2006 Might want to post a short script that can reproduce the problem you are having. SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
gleem Posted July 7, 2006 Author Share Posted July 7, 2006 (edited) Here is my code as it sits... here is the encrypting file. expandcollapse popup#include <string.au3> ;------------------------------------------------------------- ; Change time format from 24 hour to 12 hour. ;------------------------------------------------------------- ; Set hours prior to pm $NewHour = @HOUR $AMPM = ("AM") ; Change format. If @HOUR = 13 Then $NewHour = ("01") $AMPM = ("PM") EndIf If @HOUR = 14 Then $NewHour = ("02") $AMPM = ("PM") EndIf If @HOUR = 15 Then $NewHour = ("03") $AMPM = ("PM") EndIf If @HOUR = 16 Then $NewHour = ("04") $AMPM = ("PM") EndIf If @HOUR = 17 Then $NewHour = ("05") $AMPM = ("PM") EndIf If @HOUR = 18 Then $NewHour = ("06") $AMPM = ("PM") EndIf If @HOUR = 19 Then $NewHour = ("07") $AMPM = ("PM") EndIf If @HOUR = 20 Then $NewHour = ("08") $AMPM = ("PM") EndIf If @HOUR = 21 Then $NewHour = ("09") $AMPM = ("PM") EndIf If @HOUR = 22 Then $NewHour = ("10") $AMPM = ("PM") EndIf If @HOUR = 23 Then $NewHour = ("11") $AMPM = ("PM") EndIf If @HOUR = 24 Then $NewHour = ("12") $AMPM = ("PM") EndIf ; Start Main Code $logfile = ("C:\SGI-Login\Log\Log-" & @MON & "-" & @MDAY & "-" & @YEAR & ".dat") $file = FileOpen($logfile, 1) $count = 0 ;Check if file opened for reading and writeOK While 1 If $file = -1 Then waiting() $count = $count + 1 $file = FileOpen($logfile, 1) Else ExitLoop EndIf WEnd $outputdata = (@ComputerName & "|" & @UserName & "|"& @MON & "-" & @MDAY & "-" & @YEAR & "|" & $NewHour & ":" & @MIN & " " & $AMPM & "|" & @LogonServer & "|" & @OSVersion & "|" & @OSServicePack & "|" & @IPAddress1) $encrpttext = _StringEncrypt(1,$outputdata, "beta",2) FileWriteLine($file, $encrpttext) FileClose($file) exit Func waiting() if $count = 3 Then Exit sleep(60000) EndFunc Edited July 7, 2006 by gleem Link to comment Share on other sites More sharing options...
gleem Posted July 7, 2006 Author Share Posted July 7, 2006 (edited) Here is my Viewer: I want to be able to refresh as well as sort by cataglory. expandcollapse popup#include <GuiConstants.au3> #include <string.au3> #include <GuiListView.au3> ; GUI GuiCreate("SGI-Login Viewer", 800, 500) ; Menu $filemenu = GuiCtrlCreateMenu ("File") $fileitem = GuiCtrlCreateMenuitem ("Open...",$filemenu) $recentfilesmenu = GuiCtrlCreateMenu ("Recent Files",$filemenu) $separator1 = GuiCtrlCreateMenuitem ("",$filemenu) $exititem = GuiCtrlCreateMenuitem ("Exit",$filemenu) ; LIST VIEW $listView = GuiCtrlCreateListView("Computer Name|User Name|Date Logged In|Time Logged In|Login Server|Windows Version|Service Pack|IP Address", 10,10,780,460) GUISetState() ; Loop While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $fileitem $file = FileOpenDialog("Choose file...","C:\SGI-Login\Log\","DAT (*.DAT)") _GUICtrlListViewDeleteAllItems ; Get Data $open = FileOpen($file, 0) $linecount = 1 While 1 $readfile = Filereadline($open,$linecount) if $readfile = ("") Then Exitloop $decrypttext = _StringEncrypt(0, $readfile, "beta",2) GuiCtrlCreateListViewItem($decrypttext, $listView) $linecount = $linecount + 1 WEnd FileClose($open) If @error <> 1 Then GuiCtrlCreateMenuItem ($file,$recentfilesmenu) GuiSetState() Case $msg = $exititem ExitLoop EndSelect WEnd GUIDelete() Exit Edited July 7, 2006 by gleem Link to comment Share on other sites More sharing options...
GaryFrost Posted July 7, 2006 Share Posted July 7, 2006 _GUICtrlListViewDeleteAllItems($listView) SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
gleem Posted July 7, 2006 Author Share Posted July 7, 2006 _GUICtrlListViewDeleteAllItems($listView) ahhh.. makes sense now thank you.... how about sorting? Link to comment Share on other sites More sharing options...
GaryFrost Posted July 7, 2006 Share Posted July 7, 2006 suggesting looking in the beta help at the 2 functions I mentioned. SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. 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