Page 23 of 30

Re: PureLVSORT library : sorting ListIconGadgets (and more)

Posted: Tue Oct 12, 2010 11:18 am
by chi
Thanks for pointing that out, gnozal!
I already use Demivec´s StableMergeSort routine for sorting the listview... http://www.purebasic.fr/english/viewtop ... 12&t=41068

cheers, chi

Re: PureLVSORT library : sorting ListIconGadgets (and more)

Posted: Sat Oct 23, 2010 12:26 pm
by c4s
Is it possible to use the standard system sort icons for #PureLVSORT_ShowClickedHeader_Icon?
Example: http://www.thebitguru.com/site_media/up ... g_Icon.jpg

I just saw there is the PureLVSORT_SetUserIcons() function. Could you make it possible to assign the system icons here, maybe via a constant or just by default?

Re: PureLVSORT library : sorting ListIconGadgets (and more)

Posted: Mon Oct 25, 2010 8:43 am
by gnozal
c4s wrote:I just saw there is the PureLVSORT_SetUserIcons() function. Could you make it possible to assign the system icons here, maybe via a constant or just by default?
I don't know about system icons for ListView headers.
How do you get them ?

Re: PureLVSORT library : sorting ListIconGadgets (and more)

Posted: Mon Oct 25, 2010 11:51 am
by c4s
gnozal wrote:I don't know about system icons for ListView headers.
How do you get them ?
I'm not fully sure either but I found this article about it:
http://www.thebitguru.com/articles/16-H ... %20in%20C#
It is about using the HDITEM structure with HDF_SORTDOWN and HDF_SORTUP flags:
http://msdn.microsoft.com/en-us/library/ms671802.aspx

Can you do something with this?

Re: PureLVSORT library : sorting ListIconGadgets (and more)

Posted: Mon Oct 25, 2010 2:11 pm
by gnozal
c4s wrote:I'm not fully sure either but I found this article about it:
http://www.thebitguru.com/articles/16-H ... %20in%20C#It is about using the HDITEM structure with HDF_SORTDOWN and HDF_SORTUP flags:
http://msdn.microsoft.com/en-us/library/ms671802.aspx
Can you do something with this?
I use this in PureLVSORT.
I still have to provide an image : I can't use #HDF_SORTDOWN/#HDF_SORTUP to draw the 'system' icons because they are only available for Windows >= XP.

Re: PureLVSORT library : sorting ListIconGadgets (and more)

Posted: Mon Oct 25, 2010 4:26 pm
by c4s
gnozal wrote:I use this in PureLVSORT.
I still have to provide an image : I can't use #HDF_SORTDOWN/#HDF_SORTUP to draw the 'system' icons because they are only available for Windows >= XP.
Seriously who is still using something under XP? Or which developer focuses on windows 98?
Anyway that's why meant that you could add this as on optional flag. Or you could check if XP or higher is available and otherwise still draw these internal ones...I hope I was able to convince you. ;)

Re: PureLVSORT library : sorting ListIconGadgets (and more)

Posted: Tue Oct 26, 2010 8:17 am
by gnozal
c4s wrote:Anyway that's why meant that you could add this as on optional flag. Or you could check if XP or higher is available and otherwise still draw these internal ones...I hope I was able to convince you. ;)
I may release a new version with an extra flag, when I have some more time.

Re: PureLVSORT library : sorting ListIconGadgets (and more)

Posted: Tue Oct 26, 2010 8:41 am
by c4s
Thank you gnozal.

Re: PureLVSORT library : sorting ListIconGadgets (and more)

Posted: Tue Oct 26, 2010 10:28 am
by gnozal
c4s wrote:Thank you gnozal.
I just had a look, it should be easy (not too much code to change).

Re: PureLVSORT library : sorting ListIconGadgets (and more)

Posted: Tue Oct 26, 2010 11:22 am
by gnozal
Update Version 4.48 (PB4.5x version only)

Changes :
- new function : PureLVSORT_UseNativeWindowsIcons() : enable or disable 'native' windows sorting icons.
  . this feature requires Windows XP minimum with themes enabled and 'XP skin support' checked in compiler options ;
  . the 'native' icon is always to the right ;
  . if PureLVSORT doesn't detect themes support, it will use its own default icons.

Re: PureLVSORT library : sorting ListIconGadgets (and more)

Posted: Tue Oct 26, 2010 2:32 pm
by c4s
Thanks again gnozal, works perfectly!

Re: PureLVSORT library : sorting ListIconGadgets (and more)

Posted: Sun Nov 14, 2010 9:05 pm
by linkerstorm
Hi gnozal.

Have a problem to get the actual sorted column.

Scenario :
- a grid displays one column not sorted with datas like B, A and C;
- the user sort this column asc : A, B and C;
- the app reloads the grid : B, A and C but the sort arrow is displayed yet; the app can't retrieve the actual sort column (neither the sort direction).

I have used PureLVSORT_GetClickedColumn (always returns -1) and PureLVSORT_GetSortingDirection (always returns zero) with no success.

How do I get the current sorted column ans the current sort direction ?

Thanx.

Re: PureLVSORT library : sorting ListIconGadgets (and more)

Posted: Mon Nov 15, 2010 11:18 am
by gnozal
linkerstorm wrote:Have a problem to get the actual sorted column.
Scenario :
- a grid displays one column not sorted with datas like B, A and C;
- the user sort this column asc : A, B and C;
- the app reloads the grid : B, A and C but the sort arrow is displayed yet; the app can't retrieve the actual sort column (neither the sort direction).
I have used PureLVSORT_GetClickedColumn (always returns -1) and PureLVSORT_GetSortingDirection (always returns zero) with no success.
How do I get the current sorted column ans the current sort direction ?
Without code to demonstrate the issue, it's hard to tell.
Did you use PureLVSORT_SortListIconNow() to sort the gadget after "the app reloads the grid" ?

Re: PureLVSORT library : sorting ListIconGadgets (and more)

Posted: Mon Nov 15, 2010 9:15 pm
by linkerstorm
But I nned the current sorted column and the sort direction in order to use the PureLVSORT_SortListIconNow() function !
That's my goal.

Consider this piece of code :

Code: Select all

#WindowTimbres = 0
#ListIconTimbres = 0
#ButtonReload = 1

Procedure OpenWindow_WindowTimbres()
    If OpenWindow(#WindowTimbres, 120, 229, 1024, 529, "Timbres", #PB_Window_SystemMenu|#PB_Window_SizeGadget|#PB_Window_MinimizeGadget|#PB_Window_TitleBar|#PB_Window_ScreenCentered)
        ButtonGadget(#ButtonReload, 905, 60, 115, 30, "Reload")
        ListIconGadget(#ListIconTimbres, 5, 60, 895, 465, "Pays", 200, #PB_ListIcon_AlwaysShowSelection|#PB_ListIcon_FullRowSelect|#PB_ListIcon_GridLines)
        PureCOLOR_SetWindowColor(#WindowTimbres, $FFFFF3)
        PureLVSORT_SelectGadgetToSort(#ListIconTimbres, #PureLVSORT_ShowClickedHeader_IconLeft)
    EndIf
EndProcedure

Procedure LoadGrid()
    ClearGadgetItems(#ListIconTimbres)
    AddGadgetItem(#ListIconTimbres, -1, "B")
    AddGadgetItem(#ListIconTimbres, -1, "A")
    AddGadgetItem(#ListIconTimbres, -1, "C")
    MessageRequester("LVSORTTest", "PureLVSORT_GetClickedColumn :" + Str(PureLVSORT_GetClickedColumn(#ListIconTimbres)))
    MessageRequester("LVSORTTest", "PureLVSORT_GetSortingDirection :" + Str(PureLVSORT_GetSortingDirection(#ListIconTimbres)))
EndProcedure

OpenWindow_WindowTimbres()
LoadGrid()

Repeat
    ev = WaitWindowEvent()
    If ev = #PB_Event_Gadget
        If EventGadget() = #ButtonReload
            LoadGrid()
        EndIf
    EndIf
Until ev = #PB_Event_CloseWindow
- Run it.
- Sort the column.
- Reload the grid by clicking the button.
- The two functions returns, respectively, -1 and zero : why ?

EDIT : I just found the answer : I must call the two functions BEFORE the ClearGadgetItems function...

Thanx anyway, gnozal.

Re: PureLVSORT library : sorting ListIconGadgets (and more)

Posted: Tue Nov 16, 2010 8:44 am
by gnozal
linkerstorm wrote:EDIT : I just found the answer : I must call the two functions BEFORE the ClearGadgetItems function...
Yes, #LVM_DELETEALLITEMS clears the information.