Page 17 of 30

Posted: Mon Aug 04, 2008 7:53 pm
by rotacak
Is possible sort this column in right ordering?:
Image

Posted: Tue Aug 05, 2008 7:25 am
by gnozal
rotacak wrote:Is possible sort this column in right ordering?:
Image
Using #PureLVSORT_Numeric type with PureLVSORT_SetColumnType() should work.
Also note that you can define a custom sorting order using #PureLVSORT_Alphabetic_User (sorting order is defined by a user byte array [PureLVSORT_DefineAlphabeticOrder()]) or #PureLVSORT_UserCallback (sorting order is defined by a user callback [PureLVSORT_DefineUserCallback()]).

Posted: Tue Aug 05, 2008 7:16 pm
by rotacak
Hmm, #PureLVSORT_Numeric work ok, I was thinking I tryed it before, but not. And #PureLVSORT_UserCallback also helped me with another column, so thanx lot.

Posted: Mon Apr 20, 2009 5:22 pm
by X
Are there any plans for a 64bit version of this library? Right now, this is the only reliable listbox that allows for sorting properly.

Posted: Tue Apr 21, 2009 7:38 am
by gnozal
X wrote:Are there any plans for a 64bit version of this library? Right now, this is the only reliable listbox that allows for sorting properly.
When I upgrade to 64bit processor + 64bit OS, they will be released eventually. Until then, no.

Posted: Tue Apr 21, 2009 8:11 pm
by X
Thanks for the info .. :)

Is there any way to make the list sort with case insensitive?

For instance, right now ... "myNick" is above "Bobby", which isnt the correct sort order.

Posted: Wed Apr 22, 2009 7:41 am
by gnozal
X wrote:Thanks for the info .. :)

Is there any way to make the list sort with case insensitive?

For instance, right now ... "myNick" is above "Bobby", which isnt the correct sort order.
Yes.
You can define a custom sorting order using #PureLVSORT_Alphabetic_User (sorting order is defined by a user byte array [PureLVSORT_DefineAlphabeticOrder()]) or #PureLVSORT_UserCallback (sorting order is defined by a user callback [PureLVSORT_DefineUserCallback()]).

Posted: Wed Apr 22, 2009 3:14 pm
by X
Oh .. ok. I'll use an array or linked list.

Posted: Wed Apr 22, 2009 3:31 pm
by gnozal
X wrote:Oh .. ok. I'll use an array or linked list.
What is you code ?
By default, the (string) sort is case insensitive.

Posted: Thu Apr 23, 2009 2:31 am
by X
Now that I am home, I can reply :)

Well, I found that the only options are 1 and -1. Thus, after I created the control, I use:

PureLVSORT_SelectGadgetToSort(*channel\NickList, #PureLVSORT_ShowClickedHeader_No)

And when I need the items in the list box be sorted, I use ..

PureLVSORT_SortListIconNow(*channel\NickList, 0, 1)

Posted: Thu Apr 23, 2009 7:38 am
by gnozal
X wrote:Now that I am home, I can reply :)
Well, I found that the only options are 1 and -1. Thus, after I created the control, I use:
PureLVSORT_SelectGadgetToSort(*channel\NickList, #PureLVSORT_ShowClickedHeader_No)
And when I need the items in the list box be sorted, I use ..
PureLVSORT_SortListIconNow(*channel\NickList, 0, 1)
Have a look at PureLVSORT_SetColumnType() in the help file (PureLVSORT.chm) and at the example file PureLVSORT_TEST_2.pb.

Posted: Sun Apr 26, 2009 9:17 pm
by X
Thanks, I was finally able to set down and do some coding this weekend :)

It turns out that the SetColumnType() method does not do anything in PB 4.30, when it comes to alphabetizing items in a listbox.

Thanks for your help :) I'll stick with using a link list or see if I can come up with an userArray to do the alphabetizing. If I can figure that out, I'll post the code here just in case anybody else needs an alphabetized list box.

As promised .. the following code will allow this listbox userlibrary to alphabetize english entries in a list box :)

Code: Select all

Structure Array256
  Byte.b[256]
EndStructure

UserArray.Array256

; standard english sorting
For i = 0 To 255
  Select i
    Case 65 : UserArray\Byte[i] = i     ; A
    Case 66 : UserArray\Byte[i] = 97    ; a
    Case 67 : UserArray\Byte[i] = 66    ; B
    Case 68 : UserArray\Byte[i] = 98    ; b
    Case 69 : UserArray\Byte[i] = 67    ; C
    Case 70 : UserArray\Byte[i] = 99    ; c
    Case 71 : UserArray\Byte[i] = 68    ; D
    Case 72 : UserArray\Byte[i] = 100   ; d
    Case 73 : UserArray\Byte[i] = 69    ; E
    Case 74 : UserArray\Byte[i] = 101   ; e
    Case 75 : UserArray\Byte[i] = 70    ; F
    Case 76 : UserArray\Byte[i] = 102   ; f
    Case 77 : UserArray\Byte[i] = 71    ; G
    Case 78 : UserArray\Byte[i] = 103   ; g
    Case 79 : UserArray\Byte[i] = 72    ; H
    Case 80 : UserArray\Byte[i] = 104   ; h
    Case 81 : UserArray\Byte[i] = 73    ; I
    Case 82 : UserArray\Byte[i] = 105   ; i
    Case 83 : UserArray\Byte[i] = 74    ; J
    Case 84 : UserArray\Byte[i] = 106   ; j
    Case 85 : UserArray\Byte[i] = 75    ; K
    Case 86 : UserArray\Byte[i] = 107   ; k
    Case 87 : UserArray\Byte[i] = 76    ; L
    Case 88 : UserArray\Byte[i] = 108   ; l
    Case 89 : UserArray\Byte[i] = 77    ; M
    Case 90 : UserArray\Byte[i] = 109   ; m
    Case 97 : UserArray\Byte[i] = 78    ; N
    Case 98 : UserArray\Byte[i] = 110   ; n
    Case 99 : UserArray\Byte[i] = 79    ; O
    Case 100 : UserArray\Byte[i] = 111  ; o
    Case 101 : UserArray\Byte[i] = 80   ; P
    Case 102 : UserArray\Byte[i] = 112  ; p
    Case 103 : UserArray\Byte[i] = 81   ; Q
    Case 104 : UserArray\Byte[i] = 113  ; q
    Case 105 : UserArray\Byte[i] = 82   ; R
    Case 106 : UserArray\Byte[i] = 114  ; r
    Case 107 : UserArray\Byte[i] = 83   ; S
    Case 108 : UserArray\Byte[i] = 116  ; s
    Case 109 : UserArray\Byte[i] = 84   ; T
    Case 110 : UserArray\Byte[i] = 116  ; t
    Case 111 : UserArray\Byte[i] = 85   ; U
    Case 112 : UserArray\Byte[i] = 117  ; u
    Case 113 : UserArray\Byte[i] = 86   ; V
    Case 114 : UserArray\Byte[i] = 118  ; v
    Case 115 : UserArray\Byte[i] = 87   ; W
    Case 116 : UserArray\Byte[i] = 119  ; w
    Case 117 : UserArray\Byte[i] = 88   ; X
    Case 118 : UserArray\Byte[i] = 120  ; x
    Case 119 : UserArray\Byte[i] = 89   ; Y
    Case 120 : UserArray\Byte[i] = 121  ; y
    Case 121 : UserArray\Byte[i] = 90   ; Z
    Case 122 : UserArray\Byte[i] = 122  ; z
  EndSelect
Next

PureLVSORT_DefineAlphabeticOrder(@UserArray)
    
    
Ack, sorry everybody, it looks like the above code does not alphabetize correctly either.

However, SortList() with the #PB_Sort_NoCase flag will sort correctly.

Is there something you could use to sort the listbox correctly like how Fred does it?

Posted: Mon Apr 27, 2009 10:58 am
by gnozal
Could you post some code I could run that demonstrates your problem ?
All PureLVSORT sorting functions just work fine here with PB 4.30.

You are talking about listboxes ? PureLVSORT is only for ListiconGadgets (= SysListView32 <> ListBox).

Posted: Mon Apr 27, 2009 3:11 pm
by X
Sorry, im talking about ListIconGadgets as I couldnt find a pure listbox in pb :(

Maybe, I should elaborate on the os i am running. I am running Vista 64-bit Ultimate, with PB 4.30 32-bit. That might be the problem.

As for the code, I was able to replicate the problem on this userlib's example. Modified example (from the help file for setcolumnType))below:

Code: Select all

#Window_0 = 0
#ListIcon_0 = 0
Procedure Open_Window_0()
  If OpenWindow(#Window_0, 216, 0, 602, 302, "PureLVSORT User Array Test", #PB_Window_SystemMenu | #PB_Window_TitleBar | #PB_Window_ScreenCentered)
      ListIconGadget(#ListIcon_0, 5, 5, 590, 285, "User", 110)
      AddGadgetColumn(#ListIcon_0, 1, "DateDDMMYYYYHHMMSS", 130)
      AddGadgetColumn(#ListIcon_0, 2, "DateDDMMYYHHMM", 130)
      AddGadgetColumn(#ListIcon_0, 3, "DateDDMMYYYY", 120)
      AddGadgetColumn(#ListIcon_0, 4, "DateMMDDYYYY", 120)
      AddGadgetColumn(#ListIcon_0, 5, "FileSize", 120)
      AddGadgetColumn(#ListIcon_0, 6, "NoSorting", 120)
      AddGadgetItem(#ListIcon_0, -1, "éseza" + Chr(10) + "12/05/2001 06:41:30" + Chr(10) + "19/07/66 06:41" + Chr(10) + "31/12/2004" + Chr(10) + "12/31/2004" + Chr(10) + "15.02 MB" + Chr(10) + "0")
      AddGadgetItem(#ListIcon_0, -1, "zssdd" + Chr(10) + "05/07/2004 09:21:30" + Chr(10) + "12/05/01 07:50" + Chr(10) + "11/12/2004" + Chr(10) + "12/11/2004"  + Chr(10) + "65 B" + Chr(10) + "1")
      AddGadgetItem(#ListIcon_0, -1, "tdeed" + Chr(10) + "19/11/2003 07:18:31" + Chr(10) + "13/08/03 06:41" + Chr(10) + "21/01/2003" + Chr(10) + "01/21/2003" + Chr(10) + "5.98 GB" + Chr(10) + "3")
      AddGadgetItem(#ListIcon_0, -1, "ùdsdd" + Chr(10) + "19/11/2003 06:21:30" + Chr(10) + "12/05/01 06:41" + Chr(10) + "10/06/2001" + Chr(10) + "06/10/2001" + Chr(10) + "100 KB" + Chr(10) + "A")
      AddGadgetItem(#ListIcon_0, -1, "cdgdd" + Chr(10) + "19/11/2003 16:21:30" + Chr(10) + "12/05/01 06:41" + Chr(10) + "10/08/2001" + Chr(10) + "16/11/2001" + Chr(10) + "800 KB" + Chr(10) + "9")
      AddGadgetItem(#ListIcon_0, -1, "âdsdg" + Chr(10) + "19/11/2003 06:21:31" + Chr(10) + "12/05/01 06:41" + Chr(10) + "10/06/2004" + Chr(10) + "06/10/2004" + Chr(10) + "101 KB" + Chr(10) + "z")
      AddGadgetItem(#ListIcon_0, -1, "fdsdd" + Chr(10) + "19/11/2003 06:21:30" + Chr(10) + "12/05/01 06:41" + Chr(10) + "10/04/2001" + Chr(10) + "07/08/2004" + Chr(10) + "1000 B" + Chr(10) + "A")
      [b]AddGadgetItem(#ListIcon_0, -1, "Fdsdd" + Chr(10) + "19/11/2003 06:21:30" + Chr(10) + "12/05/01 06:41" + Chr(10) + "10/04/2001" + Chr(10) + "07/08/2004" + Chr(10) + "1000 B" + Chr(10) + "A")
      AddGadgetItem(#ListIcon_0, -1, "adsdd" + Chr(10) + "19/11/2003 06:21:30" + Chr(10) + "12/05/01 06:41" + Chr(10) + "10/04/2001" + Chr(10) + "07/08/2004" + Chr(10) + "1000 B" + Chr(10) + "A")[/b]
      AddGadgetItem(#ListIcon_0, -1, "Adsdd" + Chr(10) + "19/11/2003 06:21:30" + Chr(10) + "12/05/01 06:41" + Chr(10) + "10/04/2001" + Chr(10) + "07/08/2004" + Chr(10) + "1000 B" + Chr(10) + "A")
  EndIf
EndProcedure
Open_Window_0()

; ListIcon Sort Setup
If PureLVSORT_SelectGadgetToSort(#ListIcon_0, #PureLVSORT_ShowClickedHeader_IconLeft) = #PureLVSORT_Ok
  [b]PureLVSORT_SetColumnType(#ListIcon_0, 0, #PureLVSORT_String_CaseSensitive)[/b]
  PureLVSORT_SetColumnType(#ListIcon_0, 1, #PureLVSORT_DateDDMMYYYYHHMMSS)
  PureLVSORT_SetColumnType(#ListIcon_0, 2, #PureLVSORT_DateDDMMYYHHMM)
  PureLVSORT_SetColumnType(#ListIcon_0, 3, #PureLVSORT_DateDDMMYYYY)
  PureLVSORT_SetColumnType(#ListIcon_0, 4, #PureLVSORT_DateMMDDYYYY)
  PureLVSORT_SetColumnType(#ListIcon_0, 5, #PureLVSORT_FileSize)
  PureLVSORT_SetColumnType(#ListIcon_0, 6, #PureLVSORT_NoSorting)
  PureLVSORT_SortListIconNow(#ListIcon_0, 0, 1)
EndIf
;
Repeat
  Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow
End

All changes are in bold. You will notice that when ran, the order of the whole list ... but mainly the top three are as follows:

Adsdd
Fdsdd
adsdd

While they should be: en:

Adsdd
adsdd
Fdsdd

Posted: Mon Apr 27, 2009 3:32 pm
by ts-soft

Code: Select all

PureLVSORT_SetColumnType(#ListIcon_0, 0, #PureLVSORT_String)
This is the right constant!