ListIcon Gadget?

Everything else that doesn't fall into one of the other PB categories.
Killswitch
Enthusiast
Enthusiast
Posts: 731
Joined: Wed Apr 21, 2004 7:12 pm

ListIcon Gadget?

Post by Killswitch »

Can someone tell me what I am doing wrong? I am trying to add text to individual columns of the ListIcon Gadget, but I cannot do so unless I use the 'addgadgetitem' command.

Code: Select all

#Main_ListIcon=0

If OpenWindow(0, 244, 122, 493, 265,  #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_TitleBar , "Vault")
    If CreateGadgetList(WindowID())
      
      ;-
      ListIconGadget(#Main_ListIcon, 80, 10, 410, 210, "Name", 100,#PB_ListIcon_FullRowSelect|#PB_ListIcon_AlwaysShowSelection)
      AddGadgetColumn(#Main_ListIcon, 2, "Type", 100)
      AddGadgetColumn(#Main_ListIcon, 3, "Path", 100)
      AddGadgetColumn(#Main_ListIcon, 4, "Size", 100)
      
    EndIf

SetGadgetItemText(#Main_ListIcon,0,"bob",1) ;Will not add text
SetGadgetItemText(#Main_ListIcon,0,"tim",1) ;Will not add text

AddGadgetItem(#Main_ListIcon,0,"bob"+Chr(10)+"tim") ;will add text


Repeat : Until WaitWindowEvent()=#PB_Event_CloseWindow

EndIf


~I see one problem with your reasoning: the fact is thats not a chicken~
Henrik
Enthusiast
Enthusiast
Posts: 404
Joined: Sat Apr 26, 2003 5:08 pm
Location: Denmark

Post by Henrik »

hi
You can not change the text in a row thats not created yet

Try swap SetGadgetItemText and AddGadgetItem then it should work

Code: Select all

#Main_ListIcon=0

If OpenWindow(0, 244, 122, 493, 265,  #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_TitleBar , "Vault")
    If CreateGadgetList(WindowID())
     
      ;-
      ListIconGadget(#Main_ListIcon, 80, 10, 410, 210, "Name", 100,#PB_ListIcon_FullRowSelect|#PB_ListIcon_AlwaysShowSelection)
      AddGadgetColumn(#Main_ListIcon, 2, "Type", 100)
      AddGadgetColumn(#Main_ListIcon, 3, "Path", 100)
      AddGadgetColumn(#Main_ListIcon, 4, "Size", 100)
     
    EndIf

; SetGadgetItemText(#Main_ListIcon,0,"bob1",1) ;Will not add text
; SetGadgetItemText(#Main_ListIcon,0,"tim1",1) ;Will not add text

AddGadgetItem(#Main_ListIcon,0,"bob"+Chr(10)+"tim") ;will add text


SetGadgetItemText(#Main_ListIcon,0,"bob_1",0) ;Will not add text
SetGadgetItemText(#Main_ListIcon,0,"tim_1",1) ;Will not add text


Repeat : Until WaitWindowEvent()=#PB_Event_CloseWindow

EndIf

Best
Henrik
Post Reply