Jump to content

_GUICtrlListViewSort Sorting error.


Recommended Posts

Hi,

I am using v3.1.1.130 (beta), WinXP-SP2.

I created a listview and added items to it.

When i sort by specific column, the numbers in it gets changed...please see the screen shots,

before sort and after sort...check the selected row...and column value changes...

i am sorting by column 'MBox No'.

please confirm or let me know what i am doing wrong...

the code i used is:

If $msg = $ListView_SRA Then _GUICtrlListViewSort($ListView_SRA, $B_DESCENDING, GUICtrlGetState($ListView_SRA))

-Bala

Edited by Balachander K
Link to comment
Share on other sites

Sorry.

Please move this to support forum....

i think the reason for the change in text is this..

Number("222222222222222222222222222222") gives 7277124529082131342

so $a_lv[$X][$Y] = Number($v_item) line in _GUICtrlListViewSort changes 222222222222222222222222222222 to 7277124529082131342..

anybody explain please.

- Bala

Link to comment
Share on other sites

Hi,

Yes, I think I've seen somewhere that the precision of large numbers has been changed lately, bur will be restored in a beta soon?

Meantime you could use a workaround from my UDF [link in my sig];

Uses a vbs sort, seems to convert up to 39 digit long numbers , as below;

Best, Randallc

;GUISortnumb.au3
#include "_GuiCtrlListView.au3"
$timerstampS=TimerInit()
$gui=GUICreate("TEST APP!",650,650,0,0,$WS_CAPTION+$WS_POPUP+$WS_MAXIMIZEBOX+$WS_MINIMIZEBOX+$WS_SIZEBOX);+$WS_MAXIMIZE)
$listviewA = _GUICtrlCreateListViewIndexed("Column 1        |Column 2|Column3",5,5,600,600,$LVS_REPORT)
$s_twos="2222222222222222222222222222222222222222222222222222222222222222222222222222222222"
    _GUICtrlCreateListViewItem("item" & 0&"|"&0&"|1131", $listviewA,-1,0,1)
    _GUICtrlCreateListViewItem("item" & 1&"|"&21&"|1131", $listviewA,-1,0,1)
    _GUICtrlCreateListViewItem("item" & 2&"|"&210&"|1131", $listviewA,-1,0,1)
    _GUICtrlCreateListViewItem("item" & 3&"|"&22&"|1131", $listviewA,-1,0,1)
For $x = 4 To 39;00
    _GUICtrlCreateListViewItem("item" & $x&"|"&StringLeft($s_twos,$x)&"|1131", $listviewA,-1,0,1)
Next
_GUICtrlListViewSetColumnWidth($listviewA,1,$LVSCW_AUTOSIZE)
GUISetState(@SW_SHOW,$gui)
ConsoleWrite("START :"&round(TimerDiff($timerstampS)) & " mseconds "&@lf)
While 1
  $msg = GUIGetMsg()
  Select
    Case $msg = $GUI_EVENT_CLOSE
      ExitLoop
  Case $msg = $listviewA
      __GUICtrlListViewSort($listviewA, -1, GUICtrlGetState($listviewA))
  EndSelect
Wend
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...