PureLVSORT library : sorting ListIconGadgets (and more)

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

Moderator: gnozal

rule
User
User
Posts: 14
Joined: Sat Sep 02, 2006 7:56 pm
Location: Oostzaan / Netherlands

Re: PureLVSORT library : sorting ListIconGadgets (and more)

Post by rule »

gnozal wrote:It looks like your are using the wrong library version.
With PB4.51, you should be using PureLVSORT_450.zip.
Gnozal,
Thanks for the reply.
No, I'm using V4.5+ and tried it on 2 XPsp3 machines and a Win7sp1 machine. They all gave the same error.

Roel.
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 »

rule wrote:No, I'm using V4.5+ and tried it on 2 XPsp3 machines and a Win7sp1 machine. They all gave the same error.
This polink error definitly indicates a version mismatch between PB and PureLVSORT.
I could reproduce it using PureLVSORT for PB4.6x with Purebasic 4.51.

The correct PureLVSORT version for PB4.5x is http://gnozal.ucoz.com/PureLVSORT_450.zip.
I assume you downloaded http://gnozal.ucoz.com/PureLVSORT_460.zip.
See first post of this thread : http://www.purebasic.fr/english/viewtop ... 25&t=13224
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
rule
User
User
Posts: 14
Joined: Sat Sep 02, 2006 7:56 pm
Location: Oostzaan / Netherlands

Re: PureLVSORT library : sorting ListIconGadgets (and more)

Post by rule »

Gnozal,

Yes, you are right. It solved my problem, however Libmanager indicated version 4.51+ with both versions.
But nevertheless, thank you for your time and support.

Regards,
Roel.
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 »

rule wrote:Yes, you are right. It solved my problem, however Libmanager indicated version 4.51+ with both versions.
But nevertheless, thank you for your time and support.
Lib manager can only guess the version (based on the PB libraries used).
Btw, "PB4.5+" means PB4.5x or above (like PB4.6x, PB4.7x ...).
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
User avatar
Kiffi
Addict
Addict
Posts: 1353
Joined: Tue Mar 02, 2004 1:20 pm
Location: Amphibios 9

PureLVSORT: Is there an 'OnAfterSorting'-Event?

Post by Kiffi »

Hello,

this one is a simple code to explain my problem:

Code: Select all

OpenWindow(0, #PB_Ignore, #PB_Ignore, 300, 300, "")

ListIconGadget(0, 0, 0, 300, 300, "test", 100)

AddGadgetItem(0, -1, "entry1")
AddGadgetItem(0, -1, "entry2")
AddGadgetItem(0, -1, "entry3")

PureCOLOR_SetCellColor(0, 2, 0, #Black, #Green)

If PureLVSORT_SelectGadgetToSort(0, #PureLVSORT_ShowClickedHeader_IconLeft) = #PureLVSORT_Ok
  PureLVSORT_SetColumnType(0, 0, 0)
EndIf

Repeat
Until WaitWindowEvent()=#PB_Event_CloseWindow
I want to color the cell with 'entry3'. After clicking on the columnheader,
the entries are sorted but now 'entry1' ist green colored.

Is there an event like 'OnAfterSorting' (or so) so i can recolorize the Listicongadget?

Thanks in advance & Greetings ... Kiffi
Hygge
IdeasVacuum
Always Here
Always Here
Posts: 6425
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: PureLVSORT: Is there an 'OnAfterSorting'-Event?

Post by IdeasVacuum »

....What I do is to use a hammer to crack a nut - but it is fast even with long lists:

1) Save the list (PureLVSORT_SaveListIconXXX)
2) Reload the list (PureLVSORT_LoadListIconXXX)
3) Re-colour the Cell.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Re: PureLVSORT: Is there an 'OnAfterSorting'-Event?

Post by gnozal »

Kiffi wrote:Is there an event like 'OnAfterSorting' ?
Yes, there is.
It's an undocumented feature added for Srod's eGrid.

Code: Select all

#PureLVSORT_eGrid_SortIsDone = #WM_USER + 1

Procedure MyListIconCallback(WindowID, Message, wParam, lParam)
  Shared OldCB
  If OldCB
    Result = CallWindowProc_(OldCB, WindowID, Message, wParam, lParam)
    ;
    If Message = #PureLVSORT_eGrid_SortIsDone
      Debug "just sorted : listicon " + Str(GetDlgCtrlID_(WindowID)) + " (column " + Str(wParam) +")"
    EndIf
  EndIf
  ;
  ProcedureReturn Result
EndProcedure


OpenWindow(0, #PB_Ignore, #PB_Ignore, 300, 300, "")

ListIconGadget(0, 0, 0, 300, 300, "test", 100)

AddGadgetColumn(0, 1, "test 2", 100)
AddGadgetItem(0, -1, "entry1" + Chr(10) + "entry1")
AddGadgetItem(0, -1, "entry2" + Chr(10) + "entry2")
AddGadgetItem(0, -1, "entry3" + Chr(10) + "entry3")

OldCB = SetWindowLongPtr_(GadgetID(0), #GWL_WNDPROC, @MyListIconCallback())


PureCOLOR_SetCellColor(0, 2, 0, #Black, #Green)

If PureLVSORT_SelectGadgetToSort(0, #PureLVSORT_ShowClickedHeader_IconLeft) = #PureLVSORT_Ok
  PureLVSORT_SetColumnType(0, 0, 0)
EndIf

Repeat
Until WaitWindowEvent()=#PB_Event_CloseWindow
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
User avatar
Kiffi
Addict
Addict
Posts: 1353
Joined: Tue Mar 02, 2004 1:20 pm
Location: Amphibios 9

Re: PureLVSORT: Is there an 'OnAfterSorting'-Event?

Post by Kiffi »

gnozal wrote:
Kiffi wrote:Is there an event like 'OnAfterSorting' ?
Yes, there is. [...]
Great! Works like a charm. Thanks a lot! :D

@IdeasVacuum: Thanks for your answer as well.

Greetings ... Kiffi
Hygge
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 using PureLVSort in a project which has several ListIconGadgets on different contianer gadgets, how do I get Columns on different Gadgets to be editable at the same time ( so I can jump between them )

Each container gadget is hidden and is only shown when input is required. The First ListIcongadget seems to work but I can not get any of the other ones to be editable.


Is it possible if so what do I have to do to get it to work.

Using PB 4.50
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:I have been using PureLVSort in a project which has several ListIconGadgets on different contianer gadgets, how do I get Columns on different Gadgets to be editable at the same time ( so I can jump between them )

Each container gadget is hidden and is only shown when input is required. The First ListIcongadget seems to work but I can not get any of the other ones to be editable.

Is it possible if so what do I have to do to get it to work.
Without code, I can only guess...
However, this example seems to work (2 listicons in 2 containers) :

Code: Select all

Enumeration
  #Window_0
EndEnumeration
Enumeration
  #Container_2
  #ListIcon_0
  #Container_3
  #ListIcon_1
EndEnumeration
Procedure.l MyEditCallback(Event.l, ListIconNumber.l, Column.l, Row.l, Text.s)
  Select Event
    Case #PureLVSORT_EditStart
      Debug "EDITSTART " + Str(ListIconNumber) + " (" + Str(Column) + ":" + Str(Row) + ") -> '" + Text + "'"
      ; Return  :	- 0 to enable stringgadget (default)
      ; 		- *string to enable a spingadget [the string holds the choice items (separator = '|']
    Case #PureLVSORT_EditText
      Debug "EDITTEXT " + Str(ListIconNumber) + " (" + Str(Column) + ":" + Str(Row) + ") -> '" + Text + "'"
      ; Return  :	- 0 to keep the text (default)
      ; 		- *string to change the text [the string holds the changed text]
    Case #PureLVSORT_EditEnd
      Debug "EDITEND"
    Case #PureLVSORT_EditEscape
      Debug "EDITESCAPE"
  EndSelect
EndProcedure
Procedure OpenWindow_Window_0()
  If OpenWindow(#Window_0, 450, 200, 420, 400, "Window_0", #PB_Window_SystemMenu|#PB_Window_SizeGadget|#PB_Window_MinimizeGadget|#PB_Window_TitleBar)
    ContainerGadget(#Container_2, 11, 4, 400, 191, #PB_Container_Raised)
      ListIconGadget(#ListIcon_0, 17, 8, 374, 166, "Gadget_0", 100, #PB_ListIcon_AlwaysShowSelection|#PB_ListIcon_GridLines|#PB_ListIcon_FullRowSelect)
      AddGadgetColumn(#ListIcon_0, 1, "Column #2", 100)
      AddGadgetColumn(#ListIcon_0, 2, "Column #3", 100)
      AddGadgetColumn(#ListIcon_0, 3, "Column #4", 100)
    CloseGadgetList()
    ContainerGadget(#Container_3, 12, 198, 400, 201, #PB_Container_Raised)
      ListIconGadget(#ListIcon_1, 19, 17, 374, 166, "Gadget_1", 100, #PB_ListIcon_AlwaysShowSelection|#PB_ListIcon_GridLines|#PB_ListIcon_FullRowSelect)
      AddGadgetColumn(#ListIcon_1, 1, "Column #2", 100)
      AddGadgetColumn(#ListIcon_1, 2, "Column #3", 100)
      AddGadgetColumn(#ListIcon_1, 3, "Column #4", 100)
    CloseGadgetList()
    AddGadgetItem(#ListIcon_0, -1, "1" + Chr(10) + "2" + Chr(10) + "3" + Chr(10) + "4")
    AddGadgetItem(#ListIcon_0, -1, "1" + Chr(10) + "2" + Chr(10) + "3" + Chr(10) + "4")
    AddGadgetItem(#ListIcon_0, -1, "1" + Chr(10) + "2" + Chr(10) + "3" + Chr(10) + "4")
    AddGadgetItem(#ListIcon_0, -1, "1" + Chr(10) + "2" + Chr(10) + "3" + Chr(10) + "4")
    AddGadgetItem(#ListIcon_0, -1, "1" + Chr(10) + "2" + Chr(10) + "3" + Chr(10) + "4")
    SendMessage_(GadgetID(#ListIcon_0), #LVM_SETCOLUMNWIDTH, 0, #LVSCW_AUTOSIZE_USEHEADER)
    SendMessage_(GadgetID(#ListIcon_0), #LVM_SETCOLUMNWIDTH, 1, #LVSCW_AUTOSIZE_USEHEADER)
    SendMessage_(GadgetID(#ListIcon_0), #LVM_SETCOLUMNWIDTH, 2, #LVSCW_AUTOSIZE_USEHEADER)
    SendMessage_(GadgetID(#ListIcon_0), #LVM_SETCOLUMNWIDTH, 3, #LVSCW_AUTOSIZE_USEHEADER)
    AddGadgetItem(#ListIcon_1, -1, "1" + Chr(10) + "2" + Chr(10) + "3" + Chr(10) + "4")
    AddGadgetItem(#ListIcon_1, -1, "1" + Chr(10) + "2" + Chr(10) + "3" + Chr(10) + "4")
    AddGadgetItem(#ListIcon_1, -1, "1" + Chr(10) + "2" + Chr(10) + "3" + Chr(10) + "4")
    AddGadgetItem(#ListIcon_1, -1, "1" + Chr(10) + "2" + Chr(10) + "3" + Chr(10) + "4")
    AddGadgetItem(#ListIcon_1, -1, "1" + Chr(10) + "2" + Chr(10) + "3" + Chr(10) + "4")
    AddGadgetItem(#ListIcon_1, -1, "1" + Chr(10) + "2" + Chr(10) + "3" + Chr(10) + "4")
    SendMessage_(GadgetID(#ListIcon_1), #LVM_SETCOLUMNWIDTH, 0, #LVSCW_AUTOSIZE_USEHEADER)
    SendMessage_(GadgetID(#ListIcon_1), #LVM_SETCOLUMNWIDTH, 1, #LVSCW_AUTOSIZE_USEHEADER)
    SendMessage_(GadgetID(#ListIcon_1), #LVM_SETCOLUMNWIDTH, 2, #LVSCW_AUTOSIZE_USEHEADER)
    SendMessage_(GadgetID(#ListIcon_1), #LVM_SETCOLUMNWIDTH, 3, #LVSCW_AUTOSIZE_USEHEADER)
    
    PureLVSORT_SelectGadgetToSort(#ListIcon_0, #PureLVSORT_ShowClickedHeader_No)
    PureLVSORT_SelectGadgetToSort(#ListIcon_1, #PureLVSORT_ShowClickedHeader_No)
    
    PureLVSORT_MakeColumnEditable(#ListIcon_0, 1, #True)
    PureLVSORT_MakeColumnEditable(#ListIcon_1, 2, #True)
    
    PureLVSORT_SetEditingCallback(@MyEditCallback())
  EndIf
EndProcedure

OpenWindow_Window_0()

Repeat
  Event = WaitWindowEvent()
  Select Event
    Case #PB_Event_CloseWindow
        CloseWindow(#Window_0)
        Break
  EndSelect
ForEver
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
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 narrowed down my problem with PureLVSort, it seems that when you open a new window it causes some problem with the focus of PureLVsort ( not sure focus is the right word ) It upsets the the event select in the callback. Once the window is opened and active you can not get the #PureLVSORT_EditText to reappear after the window is closed.

I will try and show some code ( Source Code 8000 lines) when I have it narrowed down further.
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:Hi Gnozal,

I have narrowed down my problem with PureLVSort, it seems that when you open a new window it causes some problem with the focus of PureLVsort ( not sure focus is the right word ) It upsets the the event select in the callback. Once the window is opened and active you can not get the #PureLVSORT_EditText to reappear after the window is closed.

I will try and show some code ( Source Code 8000 lines) when I have it narrowed down further.
I added a second window to my test code. It still seems to work.

Code: Select all

Enumeration
  #Window_0
  #Window_1
EndEnumeration
Enumeration
  #Container_2
  #ListIcon_0
  #Container_3
  #ListIcon_1
EndEnumeration
Procedure.l MyEditCallback(Event.l, ListIconNumber.l, Column.l, Row.l, Text.s)
  Select Event
    Case #PureLVSORT_EditStart
      Debug "EDITSTART " + Str(ListIconNumber) + " (" + Str(Column) + ":" + Str(Row) + ") -> '" + Text + "'"
      ; Return  :   - 0 to enable stringgadget (default)
      ;       - *string to enable a spingadget [the string holds the choice items (separator = '|']
    Case #PureLVSORT_EditText
      Debug "EDITTEXT " + Str(ListIconNumber) + " (" + Str(Column) + ":" + Str(Row) + ") -> '" + Text + "'"
      ; Return  :   - 0 to keep the text (default)
      ;       - *string to change the text [the string holds the changed text]
    Case #PureLVSORT_EditEnd
      Debug "EDITEND"
    Case #PureLVSORT_EditEscape
      Debug "EDITESCAPE"
  EndSelect
EndProcedure
Procedure OpenWindow_Window_0()
  If OpenWindow(#Window_0, 450, 200, 420, 400, "Window_0", #PB_Window_SystemMenu|#PB_Window_SizeGadget|#PB_Window_MinimizeGadget|#PB_Window_TitleBar)
    ContainerGadget(#Container_2, 11, 4, 400, 191, #PB_Container_Raised)
      ListIconGadget(#ListIcon_0, 17, 8, 374, 166, "Gadget_0", 100, #PB_ListIcon_AlwaysShowSelection|#PB_ListIcon_GridLines|#PB_ListIcon_FullRowSelect)
      AddGadgetColumn(#ListIcon_0, 1, "Column #2", 100)
      AddGadgetColumn(#ListIcon_0, 2, "Column #3", 100)
      AddGadgetColumn(#ListIcon_0, 3, "Column #4", 100)
    CloseGadgetList()
    OpenWindow(#Window_1, 450, 200, 420, 400, "Window_1", #PB_Window_SystemMenu|#PB_Window_SizeGadget|#PB_Window_MinimizeGadget|#PB_Window_TitleBar)
    ContainerGadget(#Container_3, 12, 198, 400, 201, #PB_Container_Raised)
      ListIconGadget(#ListIcon_1, 19, 17, 374, 166, "Gadget_1", 100, #PB_ListIcon_AlwaysShowSelection|#PB_ListIcon_GridLines|#PB_ListIcon_FullRowSelect)
      AddGadgetColumn(#ListIcon_1, 1, "Column #2", 100)
      AddGadgetColumn(#ListIcon_1, 2, "Column #3", 100)
      AddGadgetColumn(#ListIcon_1, 3, "Column #4", 100)
    CloseGadgetList()
    AddGadgetItem(#ListIcon_0, -1, "1" + Chr(10) + "2" + Chr(10) + "3" + Chr(10) + "4")
    AddGadgetItem(#ListIcon_0, -1, "1" + Chr(10) + "2" + Chr(10) + "3" + Chr(10) + "4")
    AddGadgetItem(#ListIcon_0, -1, "1" + Chr(10) + "2" + Chr(10) + "3" + Chr(10) + "4")
    AddGadgetItem(#ListIcon_0, -1, "1" + Chr(10) + "2" + Chr(10) + "3" + Chr(10) + "4")
    AddGadgetItem(#ListIcon_0, -1, "1" + Chr(10) + "2" + Chr(10) + "3" + Chr(10) + "4")
    SendMessage_(GadgetID(#ListIcon_0), #LVM_SETCOLUMNWIDTH, 0, #LVSCW_AUTOSIZE_USEHEADER)
    SendMessage_(GadgetID(#ListIcon_0), #LVM_SETCOLUMNWIDTH, 1, #LVSCW_AUTOSIZE_USEHEADER)
    SendMessage_(GadgetID(#ListIcon_0), #LVM_SETCOLUMNWIDTH, 2, #LVSCW_AUTOSIZE_USEHEADER)
    SendMessage_(GadgetID(#ListIcon_0), #LVM_SETCOLUMNWIDTH, 3, #LVSCW_AUTOSIZE_USEHEADER)
    AddGadgetItem(#ListIcon_1, -1, "1" + Chr(10) + "2" + Chr(10) + "3" + Chr(10) + "4")
    AddGadgetItem(#ListIcon_1, -1, "1" + Chr(10) + "2" + Chr(10) + "3" + Chr(10) + "4")
    AddGadgetItem(#ListIcon_1, -1, "1" + Chr(10) + "2" + Chr(10) + "3" + Chr(10) + "4")
    AddGadgetItem(#ListIcon_1, -1, "1" + Chr(10) + "2" + Chr(10) + "3" + Chr(10) + "4")
    AddGadgetItem(#ListIcon_1, -1, "1" + Chr(10) + "2" + Chr(10) + "3" + Chr(10) + "4")
    AddGadgetItem(#ListIcon_1, -1, "1" + Chr(10) + "2" + Chr(10) + "3" + Chr(10) + "4")
    SendMessage_(GadgetID(#ListIcon_1), #LVM_SETCOLUMNWIDTH, 0, #LVSCW_AUTOSIZE_USEHEADER)
    SendMessage_(GadgetID(#ListIcon_1), #LVM_SETCOLUMNWIDTH, 1, #LVSCW_AUTOSIZE_USEHEADER)
    SendMessage_(GadgetID(#ListIcon_1), #LVM_SETCOLUMNWIDTH, 2, #LVSCW_AUTOSIZE_USEHEADER)
    SendMessage_(GadgetID(#ListIcon_1), #LVM_SETCOLUMNWIDTH, 3, #LVSCW_AUTOSIZE_USEHEADER)
    
    PureLVSORT_SelectGadgetToSort(#ListIcon_0, #PureLVSORT_ShowClickedHeader_No)
    PureLVSORT_SelectGadgetToSort(#ListIcon_1, #PureLVSORT_ShowClickedHeader_No)
    
    PureLVSORT_MakeColumnEditable(#ListIcon_0, 1, #True)
    PureLVSORT_MakeColumnEditable(#ListIcon_1, 2, #True)
    
    PureLVSORT_SetEditingCallback(@MyEditCallback())
  EndIf
EndProcedure

OpenWindow_Window_0()

Repeat
  Event = WaitWindowEvent()
  Select Event
    Case #PB_Event_CloseWindow
      CloseWindow(#Window_0)
      CloseWindow(#Window_1)
      Break
  EndSelect
ForEver
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
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 some code here that kind of shows the problem.

Code: Select all

Enumeration
  #Window_0
  #Window_1
EndEnumeration
Enumeration
  #Button_1
  #Button_2
  #Button_3
  #Button_4
  #NWCancel
  #Container_1
  #Container_2
  #Container_3
  #ListIcon_0
  #ListIcon_1
  #ListIcon_2
EndEnumeration
Procedure.l MyEditCallback(Event.l, ListIconNumber.l, Column.l, Row.l, Text.s)
  Select Event
    Case #PureLVSORT_EditStart
      Debug "EDITSTART " + Str(ListIconNumber) + " (" + Str(Column) + ":" + Str(Row) + ") -> '" + Text + "'"
      ; Return  :   - 0 to enable stringgadget (default)
      ;       - *string to enable a spingadget [the string holds the choice items (separator = '|']
    Case #PureLVSORT_EditText
      Debug "EDITTEXT " + Str(ListIconNumber) + " (" + Str(Column) + ":" + Str(Row) + ") -> '" + Text + "'"
      ; Return  :   - 0 to keep the text (default)
      ;       - *string to change the text [the string holds the changed text]
    Case #PureLVSORT_EditEnd
      Debug "EDITEND"
    Case #PureLVSORT_EditEscape
      Debug "EDITESCAPE"
  EndSelect
EndProcedure
Procedure NewWindow()
Quit = 0  
OpenWindow(#Window_1,0,0,300,175,"",#PB_Window_BorderLess|#PB_Window_ScreenCentered)
SetWindowColor(#Window_1,RGB(100,175,175))
ButtonGadget  (#NWCancel,200,145, 75, 20,"Cancel")
EndProcedure


Procedure OpenWindow_Window_0()
  If OpenWindow(#Window_0, 450, 200, 420, 400, "Window_0", #PB_Window_SystemMenu|#PB_Window_SizeGadget|#PB_Window_MinimizeGadget|#PB_Window_TitleBar)
    
    ButtonGadget(#Button_1, 10, 5, 90, 20," Container 1")
    ButtonGadget(#Button_2,110, 5, 90, 20," Container 2")
    ButtonGadget(#Button_3,210, 5, 90, 20," Container 3")
    ButtonGadget(#Button_4,310, 5, 90, 20," Window ")
    
    ContainerGadget(#Container_1, 10, 35,400,300, #PB_Container_Raised)
      ListIconGadget(#ListIcon_0, 17, 8, 374, 166, "List Gadget_0", 100, #PB_ListIcon_AlwaysShowSelection|#PB_ListIcon_GridLines|#PB_ListIcon_FullRowSelect)
      AddGadgetColumn(#ListIcon_0, 1, "Column #2", 100)
      AddGadgetColumn(#ListIcon_0, 2, "Column #3", 100)
      AddGadgetColumn(#ListIcon_0, 3, "Column #4", 100)
    CloseGadgetList()
    ContainerGadget(#Container_2, 10, 35, 400,300, #PB_Container_Raised)
      ListIconGadget(#ListIcon_1, 19, 17, 374, 166, "List Gadget_1", 100, #PB_ListIcon_AlwaysShowSelection|#PB_ListIcon_GridLines|#PB_ListIcon_FullRowSelect)
      AddGadgetColumn(#ListIcon_1, 1, "Column #2", 100)
      AddGadgetColumn(#ListIcon_1, 2, "Column #3", 100)
      AddGadgetColumn(#ListIcon_1, 3, "Column #4", 100)
    CloseGadgetList()
    ContainerGadget(#Container_3, 10, 35, 400,300, #PB_Container_Raised)
      ListIconGadget(#ListIcon_2, 19, 17, 374, 166, "ListGadget_2", 100, #PB_ListIcon_AlwaysShowSelection|#PB_ListIcon_GridLines|#PB_ListIcon_FullRowSelect)
      AddGadgetColumn(#ListIcon_2, 1, "Column #2", 100)
      AddGadgetColumn(#ListIcon_2, 2, "Column #3", 100)
      AddGadgetColumn(#ListIcon_2, 3, "Column #4", 100)
    CloseGadgetList()
    HideGadget(#Container_1,1)
    HideGadget(#Container_2,1)
    HideGadget(#Container_3,1)
    
    
    
    AddGadgetItem(#ListIcon_0, -1, "1" + Chr(10) + "2" + Chr(10) + "3" + Chr(10) + "4")
    AddGadgetItem(#ListIcon_0, -1, "1" + Chr(10) + "2" + Chr(10) + "3" + Chr(10) + "4")
    AddGadgetItem(#ListIcon_0, -1, "1" + Chr(10) + "2" + Chr(10) + "3" + Chr(10) + "4")
    AddGadgetItem(#ListIcon_0, -1, "1" + Chr(10) + "2" + Chr(10) + "3" + Chr(10) + "4")
    AddGadgetItem(#ListIcon_0, -1, "1" + Chr(10) + "2" + Chr(10) + "3" + Chr(10) + "4")
    SendMessage_(GadgetID(#ListIcon_0), #LVM_SETCOLUMNWIDTH, 0, #LVSCW_AUTOSIZE_USEHEADER)
    SendMessage_(GadgetID(#ListIcon_0), #LVM_SETCOLUMNWIDTH, 1, #LVSCW_AUTOSIZE_USEHEADER)
    SendMessage_(GadgetID(#ListIcon_0), #LVM_SETCOLUMNWIDTH, 2, #LVSCW_AUTOSIZE_USEHEADER)
    SendMessage_(GadgetID(#ListIcon_0), #LVM_SETCOLUMNWIDTH, 3, #LVSCW_AUTOSIZE_USEHEADER)
    AddGadgetItem(#ListIcon_1, -1, "1" + Chr(10) + "2" + Chr(10) + "3" + Chr(10) + "4")
    AddGadgetItem(#ListIcon_1, -1, "1" + Chr(10) + "2" + Chr(10) + "3" + Chr(10) + "4")
    AddGadgetItem(#ListIcon_1, -1, "1" + Chr(10) + "2" + Chr(10) + "3" + Chr(10) + "4")
    AddGadgetItem(#ListIcon_1, -1, "1" + Chr(10) + "2" + Chr(10) + "3" + Chr(10) + "4")
    AddGadgetItem(#ListIcon_1, -1, "1" + Chr(10) + "2" + Chr(10) + "3" + Chr(10) + "4")
    AddGadgetItem(#ListIcon_1, -1, "1" + Chr(10) + "2" + Chr(10) + "3" + Chr(10) + "4")
    SendMessage_(GadgetID(#ListIcon_1), #LVM_SETCOLUMNWIDTH, 0, #LVSCW_AUTOSIZE_USEHEADER)
    SendMessage_(GadgetID(#ListIcon_1), #LVM_SETCOLUMNWIDTH, 1, #LVSCW_AUTOSIZE_USEHEADER)
    SendMessage_(GadgetID(#ListIcon_1), #LVM_SETCOLUMNWIDTH, 2, #LVSCW_AUTOSIZE_USEHEADER)
    SendMessage_(GadgetID(#ListIcon_1), #LVM_SETCOLUMNWIDTH, 3, #LVSCW_AUTOSIZE_USEHEADER)
    AddGadgetItem(#ListIcon_2, -1, "1" + Chr(10) + "2" + Chr(10) + "3" + Chr(10) + "4")
    AddGadgetItem(#ListIcon_2, -1, "1" + Chr(10) + "2" + Chr(10) + "3" + Chr(10) + "4")
    AddGadgetItem(#ListIcon_2, -1, "1" + Chr(10) + "2" + Chr(10) + "3" + Chr(10) + "4")
    AddGadgetItem(#ListIcon_2, -1, "1" + Chr(10) + "2" + Chr(10) + "3" + Chr(10) + "4")
    AddGadgetItem(#ListIcon_2, -1, "1" + Chr(10) + "2" + Chr(10) + "3" + Chr(10) + "4")
    AddGadgetItem(#ListIcon_2, -1, "1" + Chr(10) + "2" + Chr(10) + "3" + Chr(10) + "4")
    SendMessage_(GadgetID(#ListIcon_2), #LVM_SETCOLUMNWIDTH, 0, #LVSCW_AUTOSIZE_USEHEADER)
    SendMessage_(GadgetID(#ListIcon_2), #LVM_SETCOLUMNWIDTH, 1, #LVSCW_AUTOSIZE_USEHEADER)
    SendMessage_(GadgetID(#ListIcon_2), #LVM_SETCOLUMNWIDTH, 2, #LVSCW_AUTOSIZE_USEHEADER)
    SendMessage_(GadgetID(#ListIcon_2), #LVM_SETCOLUMNWIDTH, 3, #LVSCW_AUTOSIZE_USEHEADER)
    
    
    PureLVSORT_SelectGadgetToSort(#ListIcon_0, #PureLVSORT_ShowClickedHeader_No)
    PureLVSORT_SelectGadgetToSort(#ListIcon_1, #PureLVSORT_ShowClickedHeader_No)
    PureLVSORT_SelectGadgetToSort(#ListIcon_2, #PureLVSORT_ShowClickedHeader_No)
    
    PureLVSORT_SetEditingColors(RGB(184, 223, 223), #Black)
    
    PureLVSORT_MakeColumnEditable(#ListIcon_0, 1, #True)
    PureLVSORT_MakeColumnEditable(#ListIcon_1, 2, #True)
    PureLVSORT_MakeColumnEditable(#ListIcon_2, 3, #True)
    
    PureLVSORT_SetEditingCallback(@MyEditCallback())
  EndIf
EndProcedure

OpenWindow_Window_0()

Repeat
  Event = WaitWindowEvent()
  Select Event
      
    Case #PB_Event_Gadget
           
      Select EventGadget()  
             
        Case #Button_1
          HideGadget(#Container_1,0)
          HideGadget(#Container_2,1)
          HideGadget(#Container_3,1)
        Case #Button_2
          HideGadget(#Container_1,1)
          HideGadget(#Container_2,0)
          HideGadget(#Container_3,1)
        Case #Button_3
          HideGadget(#Container_1,1)
          HideGadget(#Container_2,1)
          HideGadget(#Container_3,0)
        Case #Button_4
          NewWindow()
        Case #NWCancel
          Quit = 1
          CloseWindow(#Window_1)  
          
      EndSelect 
      
    Case #PB_Event_CloseWindow
        CloseWindow(#Window_0)
        Break
  EndSelect
ForEver
Just click on it a few times opening and closing the window.

I stumped, every thing works until I add the window and open and close it.

I sure I must be doing something wrong but I just cannot find it.
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 »

Update (PureLVSORT Plus for PB4.6x)

Changes :
- fixed GadgetList issue (posted by leodh)
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
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,

Great. Thanks for that, I was starting to batty.
:D
Regards
Leo
Post Reply