PureLVSORT library : sorting ListIconGadgets (and more)

All PureFORM, JaPBe, Libs and useful code maintained by gnozal

Moderator: gnozal

Donald
User
User
Posts: 15
Joined: Fri Jan 07, 2005 1:29 am
Location: Germany

Post by Donald »

Hi gnozal,

Sorting error with only one Column.

Code: Select all

#Window_0 = 0
#ListIcon_0 = 0
#ListIcon_1 = 1
Procedure Open_Window_0()
  If OpenWindow(#Window_0, 216, 0, 152, 382, "PureLVSORT Test",#PB_Window_SystemMenu | #PB_Window_TitleBar | #PB_Window_ScreenCentered)
    If CreateGadgetList(WindowID(#Window_0))
      ListIconGadget(#ListIcon_0, 5, 5, 140, 350, "String", 110)
      ;
      ; Sorting Error with only one Column
      ; Is the next Line aktiv Sorting OK
      ;
      ; AddGadgetColumn(#ListIcon_0, 2, "String", 110)
      ;
      AddGadgetItem(#ListIcon_0, -1, "ABCDE")
      AddGadgetItem(#ListIcon_0, -1, "BCDEF")
      AddGadgetItem(#ListIcon_0, -1, "ZABCD")
      AddGadgetItem(#ListIcon_0, -1, "DEFGH")
      AddGadgetItem(#ListIcon_0, -1, "AAAAAABCDE")
      AddGadgetItem(#ListIcon_0, -1, "FCDEF")
      AddGadgetItem(#ListIcon_0, -1, "ZABCD")
      AddGadgetItem(#ListIcon_0, -1, "DEFGH")
      AddGadgetItem(#ListIcon_0, -1, "ABCDE")
      AddGadgetItem(#ListIcon_0, -1, "BBBBBACDEF")
      AddGadgetItem(#ListIcon_0, -1, "AAAAA")
      AddGadgetItem(#ListIcon_0, -1, "KABCD")
      AddGadgetItem(#ListIcon_0, -1, "JABCD")
      AddGadgetItem(#ListIcon_0, -1, "GABCD")
      AddGadgetItem(#ListIcon_0, -1, "KABCD")
      AddGadgetItem(#ListIcon_0, -1, "JABCD")
      AddGadgetItem(#ListIcon_0, -1, "GABCD")
      AddGadgetItem(#ListIcon_0, -1, "KABCD")
      AddGadgetItem(#ListIcon_0, -1, "JABCD")
      AddGadgetItem(#ListIcon_0, -1, "GABCD")
      AddGadgetItem(#ListIcon_0, -1, "DEFGH")
    EndIf
  EndIf
EndProcedure
Open_Window_0()
If PureLVSORT_SelectGadgetToSort(#ListIcon_0, #True) = #PureLVSORT_Ok
  PureLVSORT_SetColumnType(#ListIcon_0, 0, #PureLVSORT_String) ; default, not necessary
  PureLVSORT_SortListIconNow(#ListIcon_0, 0, 1)
EndIf
;
Repeat
  Event = WaitWindowEvent()
  If EventType() = #PB_EventType_LeftDoubleClick 
    PureLVSORT_ClearGadget(#ListIcon_0)
  EndIf
Until Event = #PB_Event_CloseWindow
End
DONALD :D http://www.PureBasic-Donald.de
PureBasic - jaPBe - PureFORM - PureVisonXP - TailBite
GFABasic 16Bit 4.38 - GB32 2.30 B1160 - GFABasic DOS 4.51
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

It's a known problem but I don't know why (API limitation maybe)...
If you only want one column, there are two possible workarounds :
1. Create a second column with width = 0 (it will be invisible)

Code: Select all

AddGadgetColumn(#ListIcon_0, 1, "", 0) 
2. Use the (WinAPI) #LVS_SORTASCENDING / #LVS_SORTDESCENDING flags.

Code: Select all

ListIconGadget(#ListIcon_0, 5, 5, 140, 350, "String", 110, #LVS_SORTDESCENDING)
So you don't even need PureLVSORT !
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
Donald
User
User
Posts: 15
Joined: Fri Jan 07, 2005 1:29 am
Location: Germany

Post by Donald »

Hi Gnozal,

Thanks for the fast Answer.


Can you make a NEW-Funktion in the Lib.
PureLVSORT_ColumnLock()
PureLVSORT_ColumnUnLock()

No chance for the width possible
No Cursor for Width change for the Lock Column
No accept double klick for the Lock Column

I have a Code for this, but it does not works 100%
DONALD :D http://www.PureBasic-Donald.de
PureBasic - jaPBe - PureFORM - PureVisonXP - TailBite
GFABasic 16Bit 4.38 - GB32 2.30 B1160 - GFABasic DOS 4.51
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

Donald wrote:Can you make a NEW-Funktion in the Lib.
PureLVSORT_ColumnLock()
PureLVSORT_ColumnUnLock()
I have updated the library with 2 new functions. That's all I can do for the moment.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

Update V4.12 (both libs)

Changes :
- new function PureLVSORT_SetColumnFlag()
- new function PureLVSORT_ResetColumnFlag()
Flags wrote:#PureLVSORT_Column_Fixed : the column width is fixed
#PureLVSORT_Column_Hidden : the column is hidden
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
Donald
User
User
Posts: 15
Joined: Fri Jan 07, 2005 1:29 am
Location: Germany

Post by Donald »

Hi Gnozal,

Thank you. :D
DONALD :D http://www.PureBasic-Donald.de
PureBasic - jaPBe - PureFORM - PureVisonXP - TailBite
GFABasic 16Bit 4.38 - GB32 2.30 B1160 - GFABasic DOS 4.51
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

Update PB4.00 version only

Changes :
- fixed a PB4 related issue (lParam messed up because of the new GadgetItemData feature)
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
mskuma
Enthusiast
Enthusiast
Posts: 573
Joined: Sat Dec 03, 2005 1:31 am
Location: Australia

Post by mskuma »

Hi gnozal - thanks for the update & for collaborating with srod on making your program work with egrid. I'm interested to try the experimental PureLVSORT capability with egrid using unicode (since egrid supports unicode but I think PureLVSort doesn't support unicode yet). Are you planning to update your lib for unicode also? Thanks.
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

mskuma wrote:Hi gnozal - thanks for the update & for collaborating with srod on making your program work with egrid. I'm interested to try the experimental PureLVSORT capability with egrid using unicode (since egrid supports unicode but I think PureLVSort doesn't support unicode yet). Are you planning to update your lib for unicode also? Thanks.
Here is a unicode version you can test : http://people.freenet.de/gnozal/PureLVSORT_U.zip (library only)
It's simply compiled with a custom tailbite version (like I do for threadsafe) ; it's not tested, but since it seems to work for srod's eGrid ...

If the unicode user libs really work that way, I will add an 'automatic use UserLibUnicode subsystem' to jaPBe like I did for the threadsafe libs and the UserLibThreadsafe subsystem.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
mskuma
Enthusiast
Enthusiast
Posts: 573
Joined: Sat Dec 03, 2005 1:31 am
Location: Australia

Post by mskuma »

Thanks alot gnozal! I just quickly tried it standalone & with egrid, and looks like it works well. Excellent stuff!

I see egrid has the \subsystems\UserLibUnicode\ folder to house its lib, so I guess your lib will live there as well?

Thanks for the quick update :D
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

gnozal wrote:If the unicode user libs really work that way, I will add an 'automatic use UserLibUnicode subsystem' to jaPBe like I did for the threadsafe libs and the UserLibThreadsafe subsystem.
I for one am using the same subsystems as yourself - as I believe is MrMat and a few others. It might be worth starting a thread in which it is suggested that we all adopt the same subsystems, e.g.
  • UserLibThreadSafe
  • UserLibUnicode
  • UserLibThreadSafeUnicode
I don't know, it could make sharing libs a little easier.
I may look like a mule, but I'm not a complete ass.
mskuma
Enthusiast
Enthusiast
Posts: 573
Joined: Sat Dec 03, 2005 1:31 am
Location: Australia

Post by mskuma »

I'm totally naive about these things, but from a noob point of view, the 'downside' to this approach is noobs like me have to remember to specify the subsystem (granted it's done once per source). It's like you have to set 2 settings to get it right, the checkbox 'create unicode executable' & set this subsystem. I can see the need to do the subsystem way, but hopefully in PB's future there might be a better way to do multi-capable libs? Or maybe subsystem is this way - but seems like we're doubling up with the switches/settings in the same dialog..
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Post by ts-soft »

gnozal wrote: Here is a unicode version you can test :
thx, works on first test :D
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

I have upload my custom Tailbite version, best used with jaPBe V3.

It adds two options : /THRD and /UCOD
/THRD : compiles a threadsafe library, best placed in the UserlibThreadSafe subsystem.
/UCOD : compiles a unicode library, best placed in the UserlibUnicode subsystem.
/THRD /UCOD : compiles a unicode+threadsafe library, best placed in the UserlibUnicodeThreadSafe subsystem.

Link : http://people.freenet.de/gnozal/TailBite.zip
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

Next thing to do :
- update PureLIB library installer to handle unicode / unicode+threadsafe subsystems
- build unicode / unicode+threadsafe versions for my libs
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
Post Reply