Page 24 of 30

Re: PureLVSORT library : sorting ListIconGadgets (and more)

Posted: Tue Nov 16, 2010 8:52 pm
by linkerstorm
...but does not clear the UI where the sort arrow remains...

Re: PureLVSORT library : sorting ListIconGadgets (and more)

Posted: Wed Nov 17, 2010 8:42 am
by gnozal
linkerstorm wrote:...but does not clear the UI where the sort arrow remains...
No, you're right.
I forgot this. Should be fixed in version 4.49 (uploaded).

Re: PureLVSORT library : sorting ListIconGadgets (and more)

Posted: Thu Nov 18, 2010 7:20 am
by linkerstorm
Thanx gnozal !

Re: PureLVSORT library : sorting ListIconGadgets (and more)

Posted: Tue Nov 23, 2010 8:28 am
by Fangbeast
Gnozal, is it possible to sort on more than one column at a time?

I.e: I have a time and date field and I want the date field to be sorted first and then the time field for each date?

Re: PureLVSORT library : sorting ListIconGadgets (and more)

Posted: Wed Nov 24, 2010 10:38 am
by gnozal
Fangbeast wrote:Gnozal, is it possible to sort on more than one column at a time?
I.e: I have a time and date field and I want the date field to be sorted first and then the time field for each date?
No.
PureLVSORT uses the API LVM_SORTITEMS message, so I don't think it's possible.

Re: PureLVSORT library : sorting ListIconGadgets (and more)

Posted: Wed Nov 24, 2010 11:34 am
by Fangbeast
Okay, thanks. Pity.

When I first show records from my application, I use SQLite's ability to sort on more than one column and I was hoping to allow users to do the same live when a column was clicked.

Oh well.

Re: PureLVSORT library : sorting ListIconGadgets (and more)

Posted: Sat Nov 27, 2010 6:50 pm
by QuimV
:) Hi Gnozal,
I have a problem with my editing callback function when I need to identify the ListIconNumber that has invoked the editing callback function.
Please, look a this piece of test code:

Code: Select all

;
; PureLVSORT listicon editing example
;
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"
         ;ADDED
         Debug ListIconNumber
         ;
         ; Return   : - 0 to enable stringgadget
         ;                - *string to enable spingadget [the string holds the choice items]
         ;
         ProcedureReturn @"700|800|900|1000"
      Case #PureLVSORT_EditText
         Debug "ListIcon = "   + Str(ListIconNumber)
         Debug "Column = " + Str(Column)
         Debug "Row = " + Str(Row)
         Debug "-> Text = " + text
         ;ADDED
         Debug ListIconNumber
         ;
         ; Return   : - 0 to keep the text
         ;                - *string to change the text [the string holds the changed text]
         ;
         If text = "Change this text"
            ProcedureReturn @"to another text"
         EndIf
      Case #PureLVSORT_EditEnd
         Debug "Editing ended"
         ;ADDED
         Debug ListIconNumber
      Case #PureLVSORT_EditEscape
         Debug "Editing cancelled"
         ;ADDED
         Debug ListIconNumber
   EndSelect
   Debug "******************"
EndProcedure
;
#Window_0   = 0 
#ListIcon_0 = 100 
Procedure Open_Window_0() 
   If OpenWindow(#Window_0, 0, 0, 602, 302, "PureLVSORT Make Editable Test",   #PB_Window_SystemMenu | #PB_Window_TitleBar | #PB_Window_ScreenCentered | #PB_Window_MaximizeGadget| #PB_Window_MinimizeGadget | #PB_Window_SizeGadget) 
         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) + "1000" + 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) + "700" + 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) + "800" + 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 
   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) 
   PureLVSORT_MakeColumnEditable(#ListIcon_0, 2, #True) ; Column 2 is editable
   PureLVSORT_SetEditingColors(#Red, #White)
   PureLVSORT_SetEditingCallback(@MyEditCallback()) ; Set editing callback
EndIf 
; 
Repeat 
   Event = WaitWindowEvent() 
   Select Event 
      Case #PB_Event_Gadget 
   EndSelect 
Until Event = #PB_Event_CloseWindow 
End 
In the events #PureLVSORT_EditEnd and #PureLVSORT_EditEscape, ListIconNumber is equal to -1.
Is that correct?
I'm using PB4.51 + W7
Thanks in advanced.

Re: PureLVSORT library : sorting ListIconGadgets (and more)

Posted: Mon Nov 29, 2010 12:03 pm
by gnozal
QuimV wrote:In the events #PureLVSORT_EditEnd and #PureLVSORT_EditEscape, ListIconNumber is equal to -1.
Is that correct?
Yes, it its.
The #PureLVSORT_EditEnd and #PureLVSORT_EditEscape events do not set any parameters (-> ListIconNumber=-1, Column=-1, Row=-1, text="").
This should no be a problem, as you can only edit one Listicongadget at the time (#PureLVSORT_EditEnd is sent if the Listicongadget looses focus).

Re: PureLVSORT library : sorting ListIconGadgets (and more)

Posted: Mon Nov 29, 2010 5:29 pm
by QuimV
:) OK,
Thanks Gnozal!

Re: PureLVSORT library : sorting ListIconGadgets (and more)

Posted: Wed Dec 01, 2010 12:29 am
by QuimV
:( Gnozal,
I tried this piece of code and it seems that the #PureLVSORT_EditEnd event is not fired when the ListIcon loses the focus. Is a correct behavior?

Code: Select all

;
; PureLVSORT listicon editing example
;
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"
      Case #PureLVSORT_EditText
         Debug "ListIcon = "   + Str(ListIconNumber)
         Debug "Column = " + Str(Column)
         Debug "Row = " + Str(Row)
         Debug "-> Text = " + text
         ;
         ; Return   : - 0 to keep the text
         ;                - *string to change the text [the string holds the changed text]
         ;
         If text = "Change this text"
            ProcedureReturn @"to another text"
         EndIf
      Case #PureLVSORT_EditEnd
         Debug "Editing ended"
      Case #PureLVSORT_EditEscape
         Debug "Editing cancelled"
   EndSelect
   Debug "******************"
EndProcedure
;
#Window_0 = 0 
#ListIcon_0 = 0 
Procedure Open_Window_0() 
   If OpenWindow(#Window_0, 0, 0, 602, 320, "PureLVSORT Make Editable Test",   #PB_Window_SystemMenu | #PB_Window_TitleBar | #PB_Window_ScreenCentered | #PB_Window_MaximizeGadget| #PB_Window_MinimizeGadget | #PB_Window_SizeGadget) 
         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) + "1000" + 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) + "700" + 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) + "800" + 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 
         ;ADDED 
         ButtonGadget(1000,5,260,590,60,"Click here and ListIcon lose focus, but not abandon the edit state. PureLVSORT_EditEnd is sent if the Listicongadget loses focus?", #PB_Button_MultiLine)
   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) 
   PureLVSORT_MakeColumnEditable(#ListIcon_0, 2, #True) ; Column 2 is editable
   PureLVSORT_SetEditingColors(#Red, #White)
   PureLVSORT_SetEditingCallback(@MyEditCallback()) ; Set editing callback
EndIf 
; 
Repeat 
   Event = WaitWindowEvent() 
   Select Event 
      Case #PB_Event_Gadget 
   EndSelect 
Until Event = #PB_Event_CloseWindow 
End 
Thanks in advanced

Re: PureLVSORT library : sorting ListIconGadgets (and more)

Posted: Wed Dec 01, 2010 12:22 pm
by gnozal
QuimV wrote:I tried this piece of code and it seems that the #PureLVSORT_EditEnd event is not fired when the ListIcon loses the focus. Is a correct behavior?
Sorry, my statement was incorrect.
I meant it fires a #PureLVSORT_EditEnd event when you click on another cell of the listicon : the edited cell looses the focus, another gains it.
The editing does not end if you click on another gadget.

Re: PureLVSORT library : sorting ListIconGadgets (and more)

Posted: Wed Dec 01, 2010 7:32 pm
by QuimV
:D OK Gnozal,

One question more!
When the user click another gadget and the ListIcon lose the focus, How could I end or cancel the current edition programatically?
Is it possible?
Thanks in advanced.

Re: PureLVSORT library : sorting ListIconGadgets (and more)

Posted: Thu Dec 02, 2010 9:19 am
by gnozal
QuimV wrote:When the user click another gadget and the ListIcon lose the focus, How could I end or cancel the current edition programatically?
Is it possible?
Did you try PureLVSORT_CancelCellEditing() ?

Re: PureLVSORT library : sorting ListIconGadgets (and more)

Posted: Thu Dec 02, 2010 11:34 pm
by QuimV
Yes, but what can I do if I need to end accepting the edition?

Re: PureLVSORT library : sorting ListIconGadgets (and more)

Posted: Fri Dec 03, 2010 3:09 pm
by gnozal
Update (PureLVSORT Plus for PB4.5x)

Changes :
- added PureLVSORT_ExitCellEditing()
  Exit current cell editing (if any) and keep the current cell value.