Page 18 of 30
Posted: Mon Apr 27, 2009 4:33 pm
by gnozal
X wrote:Sorry, im talking about ListIconGadgets as I couldnt find a pure listbox in pb
It's the ListViewGadget (Windows class name = 'ListBox').
X wrote: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:
Ts-soft is right.
If you want case insensitive, why do you use #PureLVSORT_String_CaseSensitive ?
And as I said before, #PureLVSORT_String type (case insensitive) is default.
Posted: Fri May 15, 2009 4:27 am
by Cugel
Is there a way to set the default sort order to descending?
Or, more specifically, I have a an unsorted column upon startup, set to sort numerically. When the user sorts this column, it's low->high, when I'd prefer it to be high->low on first sort.
Posted: Fri May 15, 2009 8:09 am
by gnozal
Cugel wrote:I have a an unsorted column upon startup, set to sort numerically. When the user sorts this column, it's low->high, when I'd prefer it to be high->low on first sort.
1. You could use PureLVSORT_SortListIconNow() to set an initial sorting order after the listicon has been populated.
2. You could also set a custom sorting callback with PureLVSORT_DefineUserCallback() and define your own sorting order.
Posted: Wed Aug 05, 2009 9:31 pm
by rotacak
Is possible to use two different user callbacks?
Posted: Thu Aug 06, 2009 7:34 am
by gnozal
rotacak wrote:Is possible to use two different user callbacks?
No.
There is no need to, as the callback receives the listicon gadget id as parameter : you can use the same callback for several listicons.
Posted: Mon Aug 17, 2009 2:19 pm
by gnozal
Sorting problem of german umlauts
Posted: Sat Aug 22, 2009 6:56 pm
by ThoPie
I have a sorting problem with the german umlauts.
Now the sorting is:
aa
ab
oa
za
zb
öb
Is it possible to get the sorting result:
aa
ab
oa
öb
za
zb
Thank You.
Posted: Sat Aug 22, 2009 8:35 pm
by Andre
The sorting of special characters, like the german umlauts, are not supported by standard PB commands.
You will need to do it manually:
1) Including a special "abc" field in your structured linkedlist, where the ä is converted to ae, the ö to oe, etc.
2) Sort the list by this "abs" field.
3) Display the regular "name" with umlauts/special characters.
I think if Fred/Timo will include additional code into the sort commands to reflect the special characters automatically, this would be nice to have, but it will slow down the sorting process in general..... so don't think they will change anything.
PS: I've deleted your double post!
Posted: Mon Aug 24, 2009 7:51 am
by gnozal
Hi ThoPie, if you are talking about sorting with PureLVSORT, you may use :
- PureLVSORT_DefineAlphabeticOrder(*UserArray)
- PureLVSORT_DefineUserCallback(*UserCallbackAddress)
to define your own custom sorting order.
If not, I guess your post is in the wrong thread ?
Re: Sorting problem of german umlauts
Posted: Mon Aug 24, 2009 9:15 pm
by AND51
ThoPie wrote:Is it possible to get the sorting result:
aa
ab
oa
öb
za
zb
Yes, it is. A fantastic idea would be to implement a native possibility to
set a custom sorting callback. You may add your idea to the linked feature request as well.
Re: PureLVSORT library : sorting ListIconGadgets (and more)
Posted: Thu Oct 22, 2009 3:21 pm
by Polly
Hi, gnozal, PureLVSORT_GetFilterString is not working properly under Win7, as it seems to me. For columns where the user hasn't entered anything it returns garbage instead of empty string, with Pb 4.31 and 4.40b5.
Re: PureLVSORT library : sorting ListIconGadgets (and more)
Posted: Thu Oct 22, 2009 7:37 pm
by dige
Since Beta 5 a lot of bugs are fixed. may be gnozal could recompile the sources again?
thank you in advance!
Re: PureLVSORT library : sorting ListIconGadgets (and more)
Posted: Fri Oct 23, 2009 8:46 am
by gnozal
Polly wrote:Hi, gnozal, PureLVSORT_GetFilterString is not working properly under Win7, as it seems to me. For columns where the user hasn't entered anything it returns garbage instead of empty string, with Pb 4.31 and 4.40b5.
I don't have Se7en, sorry.
dige wrote:Since Beta 5 a lot of bugs are fixed. may be gnozal could recompile the sources again?
Will do.
[EDIT]Done : recompiled PureLVSORT with PB4.40b5
Re: PureLVSORT library : sorting ListIconGadgets (and more)
Posted: Thu Dec 10, 2009 11:48 pm
by dige
Would be nice to have an additional parameter for PureLVSORT_SortListIconNow:
PureLVSORT_SortListIconNow(ListIconGadget.l, ListIconColumn.l, SortDirection.l, flags.b = #True)
flags = #True : Simulate click
flags = #True : Set Icon only
to reinitalise the gui after refill an listicon
Re: PureLVSORT library : sorting ListIconGadgets (and more)
Posted: Fri Dec 11, 2009 9:40 am
by gnozal
dige wrote:Would be nice to have an additional parameter for PureLVSORT_SortListIconNow:
PureLVSORT_SortListIconNow(ListIconGadget.l, ListIconColumn.l, SortDirection.l, flags.b = #True)
flags = #True : Simulate click
flags = #True : Set Icon only
to reinitalise the gui after refill an listicon
I am not sure to understand what you are asking for ?
Set an icon without actually sorting ?
Try the example below :
Code: Select all
#MAX_pszText = 255
#HDI_TEXT = 2
#HDI_IMAGE = 32
#HDI_FORMAT = 4
#HDF_BITMAP_ON_LEFT = 0
#HDF_BITMAP_ON_RIGHT = 4096
#HDF_IMAGE = 2048
#HDF_STRING = 16384
Procedure SetHeaderImage(GadgetHandle.l, ImageIndex.l, Column.l, Align.l)
; ImageIndex : (using the lib's default images) 0 = first image [up], 1 = 2nd image [down]
; Align : #HDF_BITMAP_ON_LEFT, #HDF_BITMAP_ON_RIGHT
Protected Var.LVCOLUMN, VarHeader.HDITEM, TextColumn.s, HwndHeader.l, GadgetNumber.l
;
Debug " Set Image ; Index = " + Str(ImageIndex.l)
HwndHeader = SendMessage_(GadgetHandle, #LVM_GETHEADER, 0, 0)
TextColumn = Space(#MAX_pszText + 1)
Var\mask = #LVCF_TEXT | #LVCF_FMT
Var\pszText = @TextColumn
Var\cchTextMax = #MAX_pszText
SendMessage_(GadgetHandle, #LVM_GETCOLUMN, Column, @Var)
VarHeader\mask = #HDI_IMAGE | #HDI_FORMAT | #HDI_TEXT
VarHeader\fmt = #HDF_IMAGE | Align | #HDF_STRING | Var\fmt
VarHeader\iImage = ImageIndex
VarHeader\pszText = @TextColumn
VarHeader\cchTextMax = Len(TextColumn)
SendMessage_(HwndHeader, #HDM_SETITEM, Column, @VarHeader)
;
EndProcedure
#Window_0 = 0
#ListIcon_0 = 0
Procedure Open_Window_0()
If OpenWindow(#Window_0, 216, 0, 602, 302, "PureLVSORT V2 Test", #PB_Window_SystemMenu | #PB_Window_TitleBar | #PB_Window_ScreenCentered)
ListIconGadget(#ListIcon_0, 5, 5, 590, 285, "String", 110)
AddGadgetColumn(#ListIcon_0, 1, "Numeric", 110)
AddGadgetColumn(#ListIcon_0, 2, "Float", 110)
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, "ABCDE" + Chr(10) + "514" + Chr(10) + "0.9" + Chr(10) + "31/12/2004" + Chr(10) + "12/31/2004" + Chr(10) + "15.02 MB" + Chr(10) + "0")
AddGadgetItem(#ListIcon_0, -1, "ACDEF" + Chr(10) + "118" + Chr(10) + "1.9" + Chr(10) + "11/12/2004" + Chr(10) + "12/11/2004" + Chr(10) + "65 B" + Chr(10) + "1")
AddGadgetItem(#ListIcon_0, -1, "ZABCD" + Chr(10) + "-414" + Chr(10) + "7.0" + Chr(10) + "21/01/2003" + Chr(10) + "01/21/2003" + Chr(10) + "5.98 GB" + Chr(10) + "3")
AddGadgetItem(#ListIcon_0, -1, "DEFGH" + Chr(10) + "524" + Chr(10) + "900" + Chr(10) + "10/06/2001" + Chr(10) + "06/10/2001" + Chr(10) + "100 KB" + Chr(10) + "A")
EndIf
EndProcedure
Open_Window_0()
; ListIcon Sort Setup
If PureLVSORT_SelectGadgetToSort(#ListIcon_0, #PureLVSORT_ShowClickedHeader_IconLeft) = #PureLVSORT_Ok
PureLVSORT_SetColumnType(#ListIcon_0, 0, #PureLVSORT_String) ; default, not necessary
PureLVSORT_SetColumnType(#ListIcon_0, 1, #PureLVSORT_Numeric)
PureLVSORT_SetColumnType(#ListIcon_0, 2, #PureLVSORT_Float)
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)
EndIf
; Try with and without this line
SetHeaderImage(GadgetID(#ListIcon_0), 1, 0, #HDF_BITMAP_ON_LEFT)
;
Repeat
Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow
End