Page 27 of 30

Re: PureLVSORT library : sorting ListIconGadgets (and more)

Posted: Tue Dec 06, 2011 4:05 am
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

Re: PureLVSORT library : sorting ListIconGadgets (and more)

Posted: Tue Dec 13, 2011 1:34 pm
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$

Re: PureLVSORT library : sorting ListIconGadgets (and more)

Posted: Wed Dec 14, 2011 8:03 pm
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

Re: PureLVSORT library : sorting ListIconGadgets (and more)

Posted: Thu Dec 15, 2011 9:08 am
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 ?

Re: PureLVSORT library : sorting ListIconGadgets (and more)

Posted: Fri Dec 16, 2011 5:53 pm
by bobobo
maybe a little update in the help will do

thanks :D

Re: PureLVSORT library : sorting ListIconGadgets (and more)

Posted: Sat Dec 24, 2011 6:35 am
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??

Re: PureLVSORT library : sorting ListIconGadgets (and more)

Posted: Sat Dec 24, 2011 8:55 am
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.

Re: PureLVSORT library : sorting ListIconGadgets (and more)

Posted: Sat Dec 24, 2011 3:45 pm
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

Re: PureLVSORT library : sorting ListIconGadgets (and more)

Posted: Wed Dec 28, 2011 11:48 am
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 ?

Re: PureLVSORT library : sorting ListIconGadgets (and more)

Posted: Wed Dec 28, 2011 2:03 pm
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.

Re: PureLVSORT library : sorting ListIconGadgets (and more)

Posted: Thu Dec 29, 2011 2:51 am
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

Re: PureLVSORT library : sorting ListIconGadgets (and more)

Posted: Thu Dec 29, 2011 8:57 am
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.

Re: PureLVSORT library : sorting ListIconGadgets (and more)

Posted: Fri Jan 20, 2012 9:13 am
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

Re: PureLVSORT library : sorting ListIconGadgets (and more)

Posted: Wed Apr 11, 2012 1:22 pm
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

Re: PureLVSORT library : sorting ListIconGadgets (and more)

Posted: Thu Apr 12, 2012 8:41 am
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.