PureLVSORT library : sorting ListIconGadgets (and more)

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

Moderator: gnozal

leodh
Enthusiast
Enthusiast
Posts: 164
Joined: Sun Nov 06, 2005 6:07 am
Location: Perth Western Australia

Re: PureLVSORT library : sorting ListIconGadgets (and more)

Post by leodh »

Hi Gnozal,

I have been playing with your PureLVSort agian, and I would like to know how I could use the Editing callback.

I have a listIcongadget that I would like to let the user select input from a list.
In your demo you use;

Procedure.l MyEditCallback(Event.l, ListIconNumber.l, Column.l, Row.l, text.s)
Debug "*** EDITING CALLBACK"
Select Event
Case #PureLVSORT_EditStart
Debug "ListIcon = " + Str(ListIconNumber)
Debug "Column = " + Str(Column)
Debug "Row = " + Str(Row)
Debug "-> Editing started"
;
; Return : - 0 to enable stringgadget
; - *string to enable spingadget [the string holds the choice items]
;
ProcedureReturn @"700|800|900|1000"
....

how do I replace the @"700|800|900|1000" with text from my input list.( read from a file and can change while the program runs)
I read the info on pointers but that did not get me far.

Thank
Leo
Regards
Leo
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Re: PureLVSORT library : sorting ListIconGadgets (and more)

Post by gnozal »

leodh wrote:how do I replace the @"700|800|900|1000" with text from my input list.( read from a file and can change while the program runs)
You may replace the literal with a string variable.

Load your list from a file and store it in a (global or shared) variable, say MyList$.
In the callback, simply use ProcedureReturn @MyList$
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
User avatar
bobobo
Enthusiast
Enthusiast
Posts: 202
Joined: Mon Jun 09, 2003 8:30 am

Re: PureLVSORT library : sorting ListIconGadgets (and more)

Post by bobobo »

a very little bug ?
PureLVSORT_SetFilterTimeOut(1) works
PureLVSORT_SetFilterTimeOut(0) doesn't work but takes default 1000 i guess

PB 4.6
사십 둘 .
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Re: PureLVSORT library : sorting ListIconGadgets (and more)

Post by gnozal »

bobobo wrote:a very little bug ?
PureLVSORT_SetFilterTimeOut(1) works
PureLVSORT_SetFilterTimeOut(0) doesn't work but takes default 1000 i guess
PB 4.6
PureLVSORT uses the HDM_SETFILTERCHANGETIMEOUT message.

Code: Select all

SendMessage_(hHeader, #HDM_SETFILTERCHANGETIMEOUT, 0, PureLVSORT_FilterTimeOut) 
I guess it's a windows issue ?
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
User avatar
bobobo
Enthusiast
Enthusiast
Posts: 202
Joined: Mon Jun 09, 2003 8:30 am

Re: PureLVSORT library : sorting ListIconGadgets (and more)

Post by bobobo »

maybe a little update in the help will do

thanks :D
사십 둘 .
moob
User
User
Posts: 68
Joined: Mon Aug 01, 2011 6:16 pm

Re: PureLVSORT library : sorting ListIconGadgets (and more)

Post by moob »

Hi gnozal...

how set a filter for text??

I use PureLVSORT_SetFilter(#MyListIcon), but only filter numbers, how i do for text??

ex: i want filter for "purebasic" but not filter only i can filter numeric.

can you help me??


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

Re: PureLVSORT library : sorting ListIconGadgets (and more)

Post by gnozal »

moob wrote:I use PureLVSORT_SetFilter(#MyListIcon), but only filter numbers, how i do for text??
ex: i want filter for "purebasic" but not filter only i can filter numeric.
I don't understand your question.
The filterbar works with any kind of text, numbers or not.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
moob
User
User
Posts: 68
Joined: Mon Aug 01, 2011 6:16 pm

Re: PureLVSORT library : sorting ListIconGadgets (and more)

Post by moob »

gnozal wrote:
moob wrote:I use PureLVSORT_SetFilter(#MyListIcon), but only filter numbers, how i do for text??
ex: i want filter for "purebasic" but not filter only i can filter numeric.
I don't understand your question.
The filterbar works with any kind of text, numbers or not.
I have list ListIcon with 8940 lines, when i put in filter any text don't filter.

here is may config.

Code: Select all

      ListIconGadget(#ListIcon_41, 15, 38, 241, 492, "Index", 50, #PB_ListIcon_AlwaysShowSelection|#PB_ListIcon_GridLines|#PB_ListIcon_FullRowSelect)
      AddGadgetColumn(#ListIcon_41, 1, "ID", 65)
      AddGadgetColumn(#ListIcon_41, 2, "Name", 100)
      SendMessage_(GadgetID(#ListIcon_41), #LVM_SETCOLUMNWIDTH, 2, #LVSCW_AUTOSIZE_USEHEADER)
      If PureLVSORT_SelectGadgetToSort(#ListIcon_41, #PureLVSORT_ShowClickedHeader_IconLeft) = #PureLVSORT_Ok
        PureLVSORT_SetColumnType(#ListIcon_41, 0, #PureLVSORT_Numeric)
        PureLVSORT_SetColumnType(#ListIcon_41, 1, #PureLVSORT_Numeric)
        PureLVSORT_SetColumnType(#ListIcon_41, 2, #PureLVSORT_Alphabetic_User)
        PureLVSORT_SortListIconNow(#ListIcon_41, 1, -1)
        PureLVSORT_SetFilter(#ListIcon_41)
      EndIf
Image
Last edited by moob on Wed Dec 28, 2011 2:02 pm, edited 1 time in total.
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Re: PureLVSORT library : sorting ListIconGadgets (and more)

Post by gnozal »

moob wrote:
gnozal wrote:
moob wrote:I use PureLVSORT_SetFilter(#MyListIcon), but only filter numbers, how i do for text??
ex: i want filter for "purebasic" but not filter only i can filter numeric.
I don't understand your question.
The filterbar works with any kind of text, numbers or not.
I have list ListIcon with 8940 lines, when i put in filter any text don't filter.
Hard to say without the complete sources or a code snippet that demonstrates the issue.
Do you use a virtual listicon ?
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
moob
User
User
Posts: 68
Joined: Mon Aug 01, 2011 6:16 pm

Re: PureLVSORT library : sorting ListIconGadgets (and more)

Post by moob »

gnozal wrote:
moob wrote:
gnozal wrote:
moob wrote:I use PureLVSORT_SetFilter(#MyListIcon), but only filter numbers, how i do for text??
ex: i want filter for "purebasic" but not filter only i can filter numeric.
I don't understand your question.
The filterbar works with any kind of text, numbers or not.
I have list ListIcon with 8940 lines, when i put in filter any text don't filter.
Hard to say without the complete sources or a code snippet that demonstrates the issue.
Do you use a virtual listicon ?
No i don't.
elevy
New User
New User
Posts: 4
Joined: Sun Oct 31, 2010 2:12 am

Re: PureLVSORT library : sorting ListIconGadgets (and more)

Post by elevy »

Oops... I guess I originally posted this in the wrong place. Sorry 'bout that folks. Didn't mean to clutter things up on the root.

Anyway, here is my original post:

I am currently using PureBASIC 4.51 with the matching PureCOLOR and PureLVSORT libraries on a particular project. (I could upgrade the project to 4.60. I don't think it would cause any problems, I just haven't done it yet.)

I was wondering if there is an easy way to change the color of the filter selection bar when performing an automatic filter search as the user types in the filter header. (And I'm not talking about the normal "clicked on a row" selection bar.) Right now the selection bar is showing up as a barely visible light gray. I currently have the mechanism in place to allow the user to change the text color along with the two alternate colors for the ListView gadget, but I can't see a way to change the filter selection bar. Is this accessible via a Windows API call, or am I missing something obvious in the PureLVSORT or PureCOLOR libraries?

I'm not sure if this would be more related to PureLVSORT or PureCOLOR, so I stuck it here.

Thank you.

Eric
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Re: PureLVSORT library : sorting ListIconGadgets (and more)

Post by gnozal »

elevy wrote:I was wondering if there is an easy way to change the color of the filter selection bar when performing an automatic filter search as the user types in the filter header. (
Hi Eric,
sorry there isn't.
PureCOLOR_SetGadgetColorEx() with #PureCOLOR_LTV_SelectedItem flag does not support the filterbar.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
kinglestat
Enthusiast
Enthusiast
Posts: 732
Joined: Fri Jul 14, 2006 8:53 pm
Location: Malta
Contact:

Re: PureLVSORT library : sorting ListIconGadgets (and more)

Post by kinglestat »

Hi,

I am trying to add PureLVSORT_SelectGadgetToSort() to my program but when i compile I get and error "_PB_StringBasePosition"
I am using non-unicode, threadsafe

If I do not install the "plus" version, without .res I assume..i do not get the error, but then the constants are not defined

Can you please help?
Thanks

EDIT

Forgot about the UserLibThreadSafe
I may not help with your coding
Just ask about mental issues!

http://www.lulu.com/spotlight/kingwolf
http://www.sen3.net
kosjachok
New User
New User
Posts: 5
Joined: Thu Feb 17, 2011 11:08 pm

Re: PureLVSORT library : sorting ListIconGadgets (and more)

Post by kosjachok »

Hi
- is it possible to make the filter field - drop-down list?
- Can you help me create callback to sort on two columns at the same time
Image

Code: Select all

Procedure MyFilterCallback(GadgetNumber.l, FilterString.s, ListIconColumn.l, EventCode.l) ; simple filter example
  Shared *ListBuffer
  If EventCode = #PureLVSORT_FilterChange
    If *ListBuffer
      PureLVSORT_LoadListIconFromMem(GadgetNumber, *ListBuffer, FilterString, ListIconColumn, #True)
    EndIf
  EndIf
EndProcedure
;
#Window_0 = 0
#ListIcon_0 = 0
;
Procedure Open_Window_0()
  If OpenWindow(#Window_0, 216, 0, 602, 302, "PureLVSORT Test",  #PB_Window_SystemMenu | #PB_Window_TitleBar | #PB_Window_ScreenCentered)
    If CreateGadgetList(WindowID(#Window_0))
      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)
      AddGadgetItem(#ListIcon_0, -1, "ABCDE" + Chr(10) + "514" + Chr(10) + "0.9" + Chr(10) + "31/12/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")
      AddGadgetItem(#ListIcon_0, -1, "ZABCD" + Chr(10) + "-414" + Chr(10) + "7.0" + Chr(10) + "21/01/2003" + Chr(10) + "01/21/2003")
      AddGadgetItem(#ListIcon_0, -1, "DEFGH" + Chr(10) + "524" + Chr(10) + "900" + Chr(10) + "10/06/2001" + Chr(10) + "06/10/2001")
      AddGadgetItem(#ListIcon_0, -1, "AFFGH" + Chr(10) + "352" + Chr(10) + "911" + Chr(10) + "10/06/2004" + Chr(10) + "06/10/2003")
      AddGadgetItem(#ListIcon_0, -1, "ZSFZI" + Chr(10) + "574" + Chr(10) + "921" + Chr(10) + "10/06/2002" + Chr(10) + "06/10/2004")
      AddGadgetItem(#ListIcon_0, -1, "ZEKZH" + Chr(10) + "521" + Chr(10) + "931" + Chr(10) + "10/06/2011" + Chr(10) + "06/10/2005")
      AddGadgetItem(#ListIcon_0, -1, "ZFFGH" + Chr(10) + "523" + Chr(10) + "913" + Chr(10) + "10/06/2011" + Chr(10) + "06/10/2001")
      AddGadgetItem(#ListIcon_0, -1, "AZFHI" + Chr(10) + "522" + Chr(10) + "923" + Chr(10) + "10/06/2006" + Chr(10) + "06/10/2001")
      AddGadgetItem(#ListIcon_0, -1, "AEZGH" + Chr(10) + "529" + Chr(10) + "933" + Chr(10) + "10/06/2000" + Chr(10) + "06/11/2001")
      AddGadgetItem(#ListIcon_0, -1, "DZFKH" + Chr(10) + "624" + Chr(10) + "900" + Chr(10) + "10/07/2001" + Chr(10) + "06/11/2001")
      AddGadgetItem(#ListIcon_0, -1, "DEFGI" + Chr(10) + "625" + Chr(10) + "900" + Chr(10) + "10/08/2001" + Chr(10) + "06/11/2001")
      AddGadgetItem(#ListIcon_0, -1, "DSFKH" + Chr(10) + "623" + Chr(10) + "900" + Chr(10) + "10/09/2001" + Chr(10) + "06/11/2001")
    EndIf
  EndIf
EndProcedure
;
Open_Window_0()
;
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_SortListIconNow(#ListIcon_0, 3, 1)
  *ListBuffer = PureLVSORT_SaveListIconToMem(#ListIcon_0)
  PureLVSORT_DefineFilterCallback(@MyFilterCallback())
  PureLVSORT_SetFilterTimeOut(100)
  PureLVSORT_SetFilter(#ListIcon_0)
EndIf
;
Repeat
  Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow
If *ListBuffer
  FreeMemory(*ListBuffer)
EndIf
End
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Re: PureLVSORT library : sorting ListIconGadgets (and more)

Post by gnozal »

kosjachok wrote: - is it possible to make the filter field - drop-down list?
No.
kosjachok wrote:- Can you help me create callback to sort on two columns at the same time
PureLVSORT uses the Windows API #LVM_SORTITEMS message, so this is not possible, but there are some code examples on this forum iirc.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
Post Reply