PureLVSORT library : sorting ListIconGadgets (and more)

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

Moderator: gnozal

AND51
Addict
Addict
Posts: 1040
Joined: Sun Oct 15, 2006 8:56 pm
Location: Germany
Contact:

Post by AND51 »

Oh no... :cry: :cry:

In spite of that, have you any ideas how to solve this problem?
Maybe a invisble column? But I would prefer a feature that is more... "Professional"... Do you understand?
I've never used invisble columns... Are they really safe?
PB 4.30

Code: Select all

onErrorGoto(?Fred)
AND51
Addict
Addict
Posts: 1040
Joined: Sun Oct 15, 2006 8:56 pm
Location: Germany
Contact:

Post by AND51 »

Cosmetic error still remains:
I've already reported the bug, where the last column is not correctly autoresized.

You've corrected this, and it now works better! But there is a single case in which it does not work correctly:

If you maximize the window and then restore it, the listicon has a <--> horizontal scrollbar, although the last column's borders are visible. In other words: normally, The scrollbar mustn't appear, but it does.

Note: I've added a hidden+fixed column (width: 0 px), is that the reason?

Should I send you a video again or can you imagine what I mean?
PB 4.30

Code: Select all

onErrorGoto(?Fred)
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

AND51 wrote:I've never used invisble columns... Are they really safe?
I use the trick sometimes, and it works. You can lock/hide the column so the user can't resize it (PureLVSORT_SetColumnFlag())
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 »

AND51 wrote:If you maximize the window and then restore it, the listicon has a <--> horizontal scrollbar, although the last column's borders are visible. In other words: normally, The scrollbar mustn't appear, but it does.
It works here (Win NT4 and XP).
AND51 wrote:Note: I've added a hidden+fixed column (width: 0 px), is that the reason?
Yes, if the hidden column is the last one.
I usually use the first column and it works well.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
AND51
Addict
Addict
Posts: 1040
Joined: Sun Oct 15, 2006 8:56 pm
Location: Germany
Contact:

Post by AND51 »

It doesn't work here (XP, but XP-Skin DISABLED!).

> Yes, if the hidden column is the last one.
Yes, it was the last one, indeed. I wondered, why the last, visible column was not autoresized any more...

Now, I use the 3rd column as the hidden+fixed one, but the problem with the <---horizontal---> scrollbar still exists.
PB 4.30

Code: Select all

onErrorGoto(?Fred)
AND51
Addict
Addict
Posts: 1040
Joined: Sun Oct 15, 2006 8:56 pm
Location: Germany
Contact:

Post by AND51 »

I'll send you a video again (7z compressed).
Sorry for the bad dquality, but IMHO you can recognized everything.
The last column is really empty!

The code, which I use to create the ListIconGadget can be seen in the first frame of the video.
However, I'll send the code via PM to you, because of the bad quality of the video.
PB 4.30

Code: Select all

onErrorGoto(?Fred)
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

AND51 wrote:XP, but XP-Skin DISABLED!.
Same, works.
AND51 wrote:Now, I use the 3rd column as the hidden+fixed one, but the problem with the <---horizontal---> scrollbar still exists.
Does the example below work for you ?

Code: Select all

#Window_0 = 0 
#ListIcon_0 = 0 
Procedure Open_Window_0() 
  If OpenWindow(#Window_0, 0, 0, 602, 302, "PureLVSORT Test 1",  #PB_Window_SystemMenu | #PB_Window_TitleBar | #PB_Window_ScreenCentered | #PB_Window_MaximizeGadget| #PB_Window_MinimizeGadget | #PB_Window_SizeGadget) 
    If CreateGadgetList(WindowID(#Window_0)) 
      ListIconGadget(#ListIcon_0, 5, 5, 590, 255, "String", 100) 
      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, "DateMMDDYYYY", 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) + "12/31/2004") 
      AddGadgetItem(#ListIcon_0, -1, "ACDEF" + Chr(10) + "118" + Chr(10) + "1.9" + Chr(10) + "11/12/2004" + Chr(10) + "12/11/2004" + Chr(10)+ "12/11/2004") 
      AddGadgetItem(#ListIcon_0, -1, "ZABCD" + Chr(10) + "-414" + Chr(10) + "7.0" + Chr(10) + "21/01/2003" + Chr(10) + "01/21/2003" + Chr(10)+ "12/11/2004") 
      AddGadgetItem(#ListIcon_0, -1, "DEFGH" + Chr(10) + "524" + Chr(10) + "900" + Chr(10) + "10/06/2001" + Chr(10) + "06/10/2001" + Chr(10)+ "12/11/2004") 
      PureRESIZE_SetGadgetResize(#ListIcon_0, 1, 1, 1, 1) 
    EndIf 
  EndIf 
EndProcedure 
Open_Window_0() 
; ListIcon Sort Setup 
If PureLVSORT_SelectGadgetToSort(#ListIcon_0, #PureLVSORT_ShowClickedHeader_IconLeft) = #PureLVSORT_Ok 
  PureLVSORT_SetColumnFlag(#ListIcon_0, 0, #PureLVSORT_Column_Hidden) ; Hide column 0
  PureLVSORT_SetColumnType(#ListIcon_0, 0, #PureLVSORT_String) 
  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_SetLastColumnAutoResize(#ListIcon_0, #True) 
EndIf 
; 
Repeat 
  Event = WaitWindowEvent() 
  Select Event 
    Case #PB_Event_Gadget 
  EndSelect 
Until Event = #PB_Event_CloseWindow 
End
Example with hidden column 0, maximize / restore works ok for me (no horizontal scrollbar).
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
AND51
Addict
Addict
Posts: 1040
Joined: Sun Oct 15, 2006 8:56 pm
Location: Germany
Contact:

Post by AND51 »

Wow, you're quick!

Yes, you example works, but you've got no vertical scrollbar. Moreover, you're ListIcon is always ~3 pixel more thin than the whole listicon, although auto-resize is anebled!
This would be another bug!


Test this one!

Code: Select all

#Window_0 = 0 
#ListIcon_0 = 0 
Procedure Open_Window_0() 
  If OpenWindow(#Window_0, 0, 0, 602, 302, "PureLVSORT Test 1",  #PB_Window_SystemMenu | #PB_Window_TitleBar | #PB_Window_ScreenCentered | #PB_Window_MaximizeGadget| #PB_Window_MinimizeGadget | #PB_Window_SizeGadget) 
    If CreateGadgetList(WindowID(#Window_0)) 
      ListIconGadget(#ListIcon_0, 5, 5, 590, 255, "String", 100) 
      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, "DateMMDDYYYY", 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) + "12/31/2004") 
      AddGadgetItem(#ListIcon_0, -1, "ACDEF" + Chr(10) + "118" + Chr(10) + "1.9" + Chr(10) + "11/12/2004" + Chr(10) + "12/11/2004" + Chr(10)+ "12/11/2004") 
      AddGadgetItem(#ListIcon_0, -1, "ZABCD" + Chr(10) + "-414" + Chr(10) + "7.0" + Chr(10) + "21/01/2003" + Chr(10) + "01/21/2003" + Chr(10)+ "12/11/2004") 
      For n=1 To 25
      	AddGadgetItem(#ListIcon_0, -1, "DEFGH" + Chr(10) + "extra entry "+Str(n) + Chr(10) + "900" + Chr(10) + "10/06/2001" + Chr(10) + "06/10/2001" + Chr(10)+ "12/11/2004") 
      Next
      PureRESIZE_SetGadgetResize(#ListIcon_0, 1, 1, 1, 1) 
    EndIf 
  EndIf 
EndProcedure 
Open_Window_0() 
; ListIcon Sort Setup 
If PureLVSORT_SelectGadgetToSort(#ListIcon_0, #PureLVSORT_ShowClickedHeader_IconLeft) = #PureLVSORT_Ok 
  PureLVSORT_SetColumnFlag(#ListIcon_0, 0, #PureLVSORT_Column_Hidden) ; Hide column 0 
  PureLVSORT_SetColumnType(#ListIcon_0, 0, #PureLVSORT_String) 
  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_SetLastColumnAutoResize(#ListIcon_0, #True) 
EndIf 
; 
Repeat 
  Event = WaitWindowEvent() 
  Select Event 
    Case #PB_Event_Gadget 
  EndSelect 
Until Event = #PB_Event_CloseWindow 
End
Maximize the window, then restore it. Then, there should appear the scrollbar, as shown in the video.
Maybe, you must manually resize the last column, to make auto-resize work!
PB 4.30

Code: Select all

onErrorGoto(?Fred)
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

Update

Changes :
- improved PureLVSORT_SetLastColumnAutoResize()
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
AND51
Addict
Addict
Posts: 1040
Joined: Sun Oct 15, 2006 8:56 pm
Location: Germany
Contact:

Post by AND51 »

Hi!

Can you explain, what the improvement is?
I will test the lib of course ASAP (I have to interrupt coding now).

See you soon!
PB 4.30

Code: Select all

onErrorGoto(?Fred)
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

AND51 wrote:Hi!
Can you explain, what the improvement is?
Well, it should resize correctly (in all situations I could think about). At least, your example works now (on my PC...).
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
AND51
Addict
Addict
Posts: 1040
Joined: Sun Oct 15, 2006 8:56 pm
Location: Germany
Contact:

Post by AND51 »

Hm... The example I've posted 1 post ago works, but in my program it does not work? (Compiler was restarted...)

I would say: Good work, no more bugs in sight (up to now... :wink: ).
The project I'm currently coding is not that important.
I write again, when I see a bug.

Sorry for annyoing you so much. :P
PB 4.30

Code: Select all

onErrorGoto(?Fred)
AND51
Addict
Addict
Posts: 1040
Joined: Sun Oct 15, 2006 8:56 pm
Location: Germany
Contact:

Post by AND51 »

Bug found!

I've got 2 files. Both files were edited on May 1st, 2007.

File 1 was edited at 8:20 pm, file 2 was edited 8:21 pm.

Your Lib is sorting wrong...!

I use #PureLVSORT_DateDDMMYYHHMM, but this option doesn't sorty correctly!! Look at the first two entries, they must be swapped!

And have a look athe other entries, they are totally mixed up!
//Edit: #PureLVSORT_DateDDMMYYYYHHMMSS works correctly with and withut appending the seconds!


The column "Zuletzt geändert" should sort the files by their last-modified-time in descending order.

Image


Just another Problem:
Either there are two Y's missing in #PureLVSORT_DateDDMMYYHHMM or I should note the last to digits of the year. Please, solve this little problem, too.
You example in the help suggests, thet I must write the whole year with 4 digits, but then you must add 'YY' to the constant.
PB 4.30

Code: Select all

onErrorGoto(?Fred)
AND51
Addict
Addict
Posts: 1040
Joined: Sun Oct 15, 2006 8:56 pm
Location: Germany
Contact:

Post by AND51 »

Bug found!

SetLastColumnAutoResize does always resize so, that it fit's the content. But the help makes you think that it resizes the last column so that it fits the listicon.

See the image I've posted above. If I resize the colum USES, a horizontal scrollbar appears, because the last column is made lager (to fit the content).

So, please note this behaviour in the manual or change the behaviour.
PB 4.30

Code: Select all

onErrorGoto(?Fred)
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

2AND51
- DateDDMMYYHHMM works with dates like "31/12/04 11:20". The example in the help is wrong.
- I have changed the code for PureLVSORT_SetLastColumnAutoResize() in the next version. It works now like I think it should.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
Post Reply