listicon gadget / gtk_tree_view search problem

Linux specific forum
lexvictory
Addict
Addict
Posts: 1027
Joined: Sun May 15, 2005 5:15 am
Location: Australia
Contact:

listicon gadget / gtk_tree_view search problem

Post by lexvictory »

for some reason the search function of the listicon gadget doesnt work when there are multiple columns... (search as in start typing in the gadget and it auto searches)
compile this code, first with the addgadgetcolumn lines, 2nd time with them commented. typing something in the stringgadget doesnt produce results with the columns, but does without. (the gtk_tree_view_set_search_entry line make the string gadget be the search box, instead of using gtk one)

Code: Select all

ImportC "/usr/lib/libgtk-x11-2.0.so"
gtk_tree_view_set_search_entry(treeview, stringentry)
EndImport

OpenWindow(0, 0, 0, 700,500, "Xander's Media Library", #PB_Window_ScreenCentered)
CreateGadgetList(WindowID(0))
StringGadget(4, 0, 0, 500, 30, "")
ListIconGadget(3, 0, 31, 700, 469, "Name", 220, #PB_ListIcon_FullRowSelect|#PB_ListIcon_AlwaysShowSelection)
AddGadgetColumn(3, 1, "Age", 200)
AddGadgetColumn(3, 2, "Height", 200)
AddGadgetItem(3, -1, "Alex"+#LF$+"52"+#LF$+"170cm")
AddGadgetItem(3, -1, "Barry"+#LF$+"25"+#LF$+"175cm")
AddGadgetItem(3, -1, "Bradley"+#LF$+"17"+#LF$+"160cm")
AddGadgetItem(3, -1, "Larry"+#LF$+"20"+#LF$+"170cm")
AddGadgetItem(3, -1, "Gary"+#LF$+"2"+#LF$+"170cm")

gtk_tree_view_set_search_entry(GadgetID(3), GadgetID(4))

Repeat
  Select WaitWindowEvent()
    Case #PB_Event_CloseWindow
      quit = 1
  EndSelect
Until quit = 1
anyone know how to fix it?
or is it just my gtk version?
Demonio Ardente

Currently managing Linux & OS X Tailbite
OS X TailBite now up to date with Windows!
walker
Enthusiast
Enthusiast
Posts: 634
Joined: Wed May 05, 2004 4:04 pm
Location: Germany

Post by walker »

I have the same problem and tried to hunt it down for a bug report... I guess I'd found it.... I'll report this in the bug-section
try (your code slightly modified)

Code: Select all

ImportC "/usr/lib/libgtk-x11-2.0.so"
gtk_tree_view_set_search_entry(treeview, stringentry)
EndImport

OpenWindow(0, 0, 0, 700,500, "Xander's Media Library", #PB_Window_ScreenCentered)
CreateGadgetList(WindowID(0))
StringGadget(4, 0, 0, 500, 30, "")

ListIconGadget(3, 0, 31, 700, 469, "Name", 220, #PB_ListIcon_FullRowSelect|#PB_ListIcon_AlwaysShowSelection)
AddGadgetColumn(3, 1, "Age", 200)
AddGadgetColumn(3, 2, "Height", 200)
AddGadgetItem(3, -1, "Alex"+#LF$+"52"+#LF$+"170cm")
AddGadgetItem(3, -1, "Barry"+#LF$+"25"+#LF$+"175cm")
AddGadgetItem(3, -1, "Bradley"+#LF$+"17"+#LF$+"160cm")
AddGadgetItem(3, -1, "Larry"+#LF$+"20"+#LF$+"170cm")
AddGadgetItem(3, -1, "Gary"+#LF$+"2"+#LF$+"170cm")
ClearGadgetItemList(3)
gtk_tree_view_set_search_entry(GadgetID(3), GadgetID(4))

RemoveGadgetColumn(3,2)
RemoveGadgetColumn(3,1)
RemoveGadgetColumn(3,0)

AddGadgetColumn(3, 0, "Name", 200)
AddGadgetColumn(3, 1, "Age", 200)
AddGadgetColumn(3, 2, "Height", 200)
AddGadgetItem(3, -1, "Alex"+#LF$+"52"+#LF$+"170cm")
AddGadgetItem(3, -1, "Barry"+#LF$+"25"+#LF$+"175cm")
AddGadgetItem(3, -1, "Bradley"+#LF$+"17"+#LF$+"160cm")
AddGadgetItem(3, -1, "Larry"+#LF$+"20"+#LF$+"170cm")
AddGadgetItem(3, -1, "Gary"+#LF$+"2"+#LF$+"170cm")
gtk_tree_view_set_search_entry(GadgetID(3), GadgetID(4))
Repeat
  Select WaitWindowEvent()
    Case #PB_Event_CloseWindow
      quit = 1
  EndSelect
Until quit = 1
lexvictory
Addict
Addict
Posts: 1027
Joined: Sun May 15, 2005 5:15 am
Location: Australia
Contact:

Post by lexvictory »

wow! thanks, very strange on why it works.... how did u come up with it?

changed ur code a bit to avoid unneeded repetitions (and moved set_search_entry for the fun of it - makes no difference):

Code: Select all

ImportC "/usr/lib/libgtk-x11-2.0.so"
gtk_tree_view_set_search_entry(treeview, stringentry)
EndImport

OpenWindow(0, 0, 0, 700,500, "Listicon search", #PB_Window_ScreenCentered)
CreateGadgetList(WindowID(0))
StringGadget(4, 0, 0, 500, 30, "")

ListIconGadget(3, 0, 31, 700, 469, "Name", 220, #PB_ListIcon_FullRowSelect|#PB_ListIcon_AlwaysShowSelection)
gtk_tree_view_set_search_entry(GadgetID(3), GadgetID(4))

AddGadgetColumn(3, 1, "Age", 200)
AddGadgetColumn(3, 2, "Height", 200)
RemoveGadgetColumn(3,2)
RemoveGadgetColumn(3,1)
RemoveGadgetColumn(3,0)
AddGadgetColumn(3, 0, "Name", 200)
AddGadgetColumn(3, 1, "Age", 200)
AddGadgetColumn(3, 2, "Height", 200)

AddGadgetItem(3, -1, "Alex"+#LF$+"52"+#LF$+"170cm")
AddGadgetItem(3, -1, "Barry"+#LF$+"25"+#LF$+"175cm")
AddGadgetItem(3, -1, "Bradley"+#LF$+"17"+#LF$+"160cm")
AddGadgetItem(3, -1, "Larry"+#LF$+"20"+#LF$+"170cm")
AddGadgetItem(3, -1, "Gary"+#LF$+"2"+#LF$+"170cm")

Repeat
  Select WaitWindowEvent()
    Case #PB_Event_CloseWindow
      quit = 1
  EndSelect
Until quit = 1
Demonio Ardente

Currently managing Linux & OS X Tailbite
OS X TailBite now up to date with Windows!
walker
Enthusiast
Enthusiast
Posts: 634
Joined: Wed May 05, 2004 4:04 pm
Location: Germany

Post by walker »

lexvictory wrote:wow! thanks, very strange on why it works.... how did u come up with it?

changed ur code a bit to avoid unneeded repetitions (and moved set_search_entry for the fun of it - makes no difference):
I have 2 ListIconGadgets in one of my apps I'm developing ATM... and they have a very different behavior...
so I searched for differences how I treat them... and found this :roll: (took me some days....)

yes, I know that some code above was too much just used copy and paste... (see my bug-report)
anyway it's a very weired bug....isn't it?
Post Reply