Page 16 of 30

Posted: Thu Jan 17, 2008 5:01 pm
by Xombie
gnozal,

But is it possible to use this procedure to change the filtering behavior? For example, if I have a numeric column and I want to use the filter for greater than or equal to rather than just equal to.

I'm probably not explaining very well.

Posted: Thu Jan 17, 2008 6:21 pm
by gnozal
You could use this procedure to change the listicon content after #HDN_FILTERCHANGE or #HDN_FILTERBTNCLICK events.

Posted: Thu Jan 17, 2008 9:09 pm
by Vladi
Yeah, it is possible, but a lot of work. It would be quite easier if the library would do the restore procedure and would ask by callback wether to add this one row or not. When do not want to use another filter logic than that provided by LoadfromMem function you have to the loading on your own and hack your save format.

Another point is that the filter callback does not work when column width is fixed with

Code: Select all

PureLVSORT_SetColumnFlag(#ListIcon_0,1,#PureLVSORT_Column_Fixed)

Posted: Fri Jan 18, 2008 11:16 am
by gnozal
Vladi wrote:Another point is that the filter callback does not work when column width is fixed with

Code: Select all

PureLVSORT_SetColumnFlag(#ListIcon_0,1,#PureLVSORT_Column_Fixed)
Yes, it seems that Windows doesn't send a #HDN_FILTERCHANGE message if you return #True for #HDN_ITEMCHANGING [to lock the column width] for the same column.

Posted: Sat Jan 19, 2008 7:27 pm
by Xombie
gnozal,

I don't know how you're handling the filter but what if you added a PureLVSORT_SetColumnFilterType() and have types such as #PureLVSORT_Filter_Equal, #PureLVSORT_Filter_GreaterThan, #PureLVSORT_Filter_Greater... etc....?

That way the user could specify how they want a column to filter when they first set it up.

Posted: Sat Jan 19, 2008 7:50 pm
by Xombie
In addition to the above post, I have a couple more things to harass you about :)

Can we have a flag that turns off filtering while typing the filter? This would force the user to click the little filter button. For large lists it can lock the app while you're trying to type the whole thing.

Is there anything that can be done to add in the speed of filtering on large lists? For example, in one app I have a little bit over 10,000 lines and it takes a while to filter. Is there a bottleneck somewhere that can be worked around? Similar to your PureLVSORT_Disabled(#True) when loading large lists.

Thanks again for all your help!

EDIT: I forgot the other thing. What about the possibility of multiple sort orders? Allow the user to define them by holding down the CTRL key and clicking on a column header. The first column to sort is defined by clicking without the CTRL key down but the second, third, etc... columns are defined by holding down the CTRL key.

Posted: Mon Jan 21, 2008 11:20 am
by gnozal
Xombie wrote:I don't know how you're handling the filter but what if you added a PureLVSORT_SetColumnFilterType() and have types such as #PureLVSORT_Filter_Equal, #PureLVSORT_Filter_GreaterThan, #PureLVSORT_Filter_Greater... etc....?
The PureLVSORT_SetFilterString() function uses the #HDM_SETITEM message with #HDFT_ISSTRING type. I don't think > or < filter types are possible with this function.
But the filtering callback is designed for this for this.
Xombie wrote:Can we have a flag that turns off filtering while typing the filter? This would force the user to click the little filter button. For large lists it can lock the app while you're trying to type the whole thing.
Did you try the filtering callback ?
You can choose to react only to a #PureLVSORT_FilterBtnClick event (so nothing is done while the user is typing some text [#PureLVSORT_FilterChange event]) :

Code: Select all

Procedure MyFilterCallback(GadgetNumber.l, FilterString.s, ListIconColumn.l, EventCode.l) ; simple search example
  Protected itemNumber.l, I.l
  If FilterString And EventCode = #PureLVSORT_FilterBtnClick 
    itemNumber = -1
    If IsGadget(GadgetNumber)
      ; Search for string
      For I = 0 To CountGadgetItems(GadgetNumber) - 1 
        If FilterString = GetGadgetItemText(GadgetNumber, I, ListIconColumn) 
          itemNumber = I
          Break
        EndIf 
      Next 
      ;
      If itemNumber <> -1 ; if string found, scroll to row
        PureLVSORT_ScrollToRow(GadgetNumber, itemNumber)
        SetGadgetItemState(GadgetNumber, itemNumber, GetGadgetItemState(GadgetNumber, itemNumber) | #PB_ListIcon_Selected)
      EndIf
    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") 
    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)
  PureLVSORT_DefineFilterCallback(@MyFilterCallback())
  PureLVSORT_SetFilterTimeOut(100)
  PureLVSORT_SetFilter(#ListIcon_0)
EndIf 
; 
Repeat 
  Event = WaitWindowEvent() 
Until Event = #PB_Event_CloseWindow 
End
Xombie wrote:Is there anything that can be done to add in the speed of filtering on large lists? For example, in one app I have a little bit over 10,000 lines and it takes a while to filter. Is there a bottleneck somewhere that can be worked around? Similar to your PureLVSORT_Disabled(#True) when loading large lists.
Again you can use the filtering callback and choose you own filtering code.
Xombie wrote:What about the possibility of multiple sort orders? Allow the user to define them by holding down the CTRL key and clicking on a column header. The first column to sort is defined by clicking without the CTRL key down but the second, third, etc... columns are defined by holding down the CTRL key.
As PureLVSORT uses the #LVM_SORTITEMS Windows message, I don't think this is possible.

Posted: Mon Jan 21, 2008 6:02 pm
by Xombie
gnozal,

Thanks a lot for your patience with me.
Again you can use the filtering callback and choose you own filtering code.
:oops: I think I just realized what's going on. I'm using your example from the PureLVSORT_LoadListIconFromMem() help entry as my test. So basically the filter callback is not doing the filtering. It's the LoadListIconFromMem call that's doing it. And you're just passing the filter parameters there. Garrrr... I'm blind and dumb :) So that's what you've meant when you said I could do my own filtering code.

I think I'm all set. Thanks again!

EDIT: I put in my own filtering routine and got the time down from 4500+ ms to 313 ms. Yay!

Posted: Sun Jan 27, 2008 11:12 pm
by Xombie
gnozal,

For the filter callback, is there any chance to add a #PureLVSORT_FilterReturn event code that is handled when the user presses the enter key in the filter field?

Posted: Mon Jan 28, 2008 11:33 am
by gnozal
Xombie wrote:For the filter callback, is there any chance to add a #PureLVSORT_FilterReturn event code that is handled when the user presses the enter key in the filter field?
I will see if this is possible...

Posted: Thu May 22, 2008 1:18 pm
by gnozal
Update

(PB 4.2x version only)

Changes :
- recompiled with PB 4.20 beta 6

Posted: Tue May 27, 2008 4:32 pm
by gnozal
Update (PB4.20 version only)

Changes :
Recompiled for PB4.20 final with 'exported string function fix'

See this thread for more information : http://www.purebasic.fr/english/viewtop ... 0&start=18

Posted: Sat Aug 02, 2008 1:30 pm
by Thorsten1867
LvSort seems to destroy my database id's (GadgetItemData) in the ListIconGadget.

Posted: Mon Aug 04, 2008 7:37 am
by gnozal
Thorsten1867 wrote:LvSort seems to destroy my database id's (GadgetItemData) in the ListIconGadget.
Yes.
PureLVSORT.chm wrote:Important note : PureLVSORT uses the Windows #LVM_SORTITEMS message to sort the listicongadget, and this implies using LV_ITEM\lParam (so the sorting is not compatible with Set/GetGadgetItemData(), or the other way round : the Purebasic listicongadget is not 100% Windows API compatible : it's not a simple SysListView32).

Posted: Mon Aug 04, 2008 12:28 pm
by Thorsten1867
Sorry, I use LVSort since PB V3.x and so I don't read the help file.