Rahul Rohela Posted December 28, 2005 Share Posted December 28, 2005 We can sort List View with help of _GUICtrlListViewSort . Does any one have Idea to sort IP ListView. As is not sorting IP as per requirment. Please help to Sort IP Address list view.. Link to comment Share on other sites More sharing options...
Rahul Rohela Posted January 7, 2006 Author Share Posted January 7, 2006 ANY IDEA??? Link to comment Share on other sites More sharing options...
HardCopy Posted January 8, 2006 Share Posted January 8, 2006 ANY IDEA???Please Show an example of the data as it is sorting now & anexample of how you were expecting it to sort, then perhaps myself or anothercan help you.--HardCopy Contributions: UDF _DateYearFirstChildren are like Farts, you can just about stand your own.Why am I not a Vegetarian?...Well...my ancestors didn't fight & evolve to the Top of the food chain for me to survive on Salad Link to comment Share on other sites More sharing options...
Rahul Rohela Posted January 10, 2006 Author Share Posted January 10, 2006 Please Show an example of the data as it is sorting now & anexample of how you were expecting it to sort, then perhaps myself or anothercan help you.--HardCopyHIHere i am attaching files. one is example with normal data & second is with IP data.Its not sorting data as per IP list.Please check...thx rahul_GUICtrlListViewSort.au3Sort_IP.au3 Link to comment Share on other sites More sharing options...
HardCopy Posted January 11, 2006 Share Posted January 11, 2006 (edited) HI Here i am attaching files. one is example with normal data & second is with IP data. Its not sorting data as per IP list. Please check... thx rahul Rahul I had similar problems a while back with sorting pre formatted prices 2.45 , 0.56. 1.52 0.98 etc. do a search for "sorting prices" you should find that thread. To get around it i had to pad the numbers to equal lengths with white space then it will get sorted in the sequence you require. Here is your SortIP example with the last field of the ip address padded with whitespace to 3 characters. #include <GuiConstants.au3> #include <GuiListView.au3> ;Const $LVS_SORTDESCENDING = 0x0020 opt('MustDeclareVars', 1) Dim $listview, $Btn_Exit, $msg, $Status, $Btn_Insert, $ret, $Input_Index GUICreate("ListView Sort", 392, 322) $listview = GUICtrlCreateListView("col1|col2|col3", 40, 30, 310, 149, -1, BitOR($LVS_EX_REGIONAL, $LVS_EX_FULLROWSELECT, $LVS_EX_GRIDLINES)) GUICtrlCreateListViewItem("192.100.100. 2|5data|more_a", $listview);; added whitespace to make 3chars GUICtrlCreateListViewItem("192.100.100. 50|4data|more_c", $listview) GUICtrlCreateListViewItem("192.100.100. 5|3data|more_e", $listview) GUICtrlCreateListViewItem("192.100.100.105|2data|more_d", $listview) GUICtrlCreateListViewItem("192.100.100.245|1data|more_b", $listview) _GUICtrlListViewSetColumnWidth ($listview, 0, 75) _GUICtrlListViewSetColumnWidth ($listview, 1, 75) _GUICtrlListViewSetColumnWidth ($listview, 2, 75) $Btn_Exit = GUICtrlCreateButton("Exit", 300, 260, 70, 30) GUISetState() Dim $B_DESCENDING[_GUICtrlListViewGetSubItemsCount ($listview) ] While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit ExitLoop Case $msg = $listview ; sort the list by the column header clicked on _GUICtrlListViewSort($listview, $B_DESCENDING, GUICtrlGetState($listview)) EndSelect WEnd Exit This sorts as you are expecting, but if the IP addresses are not hard coded, you will need to write a routine that gets the ip address, & pad out the last . xxx field of the address to 3 characters, if not already 3 chars in length. Someone better qualified than myself, can be more implicit with a solution for you, but i hope this points you in the right direction. HardCopy Edited January 11, 2006 by HardCopy Contributions: UDF _DateYearFirstChildren are like Farts, you can just about stand your own.Why am I not a Vegetarian?...Well...my ancestors didn't fight & evolve to the Top of the food chain for me to survive on Salad Link to comment Share on other sites More sharing options...
Rahul Rohela Posted January 11, 2006 Author Share Posted January 11, 2006 HardCopy Thanks for your priceless help.. Now i will try to figure this out. Thx 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