Change Items in a ListView

Just starting out? Need help? Post your questions and find answers here.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by tranquil.

Hi Everybodey!!

Would like to know if it is possible to change a ListIconItem or a TreeIcon-Item without cleaning the whole list and load it again!?

Fred, possible to add something like ChangeGadgetItem(#Gadget,Position,String$)?

That would be very nice!


Cheers,

Mike

Tranquilizer/ Secretly!
Registred PureBasic User
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by PB.
Would like to know if it is possible to change a ListIconItem or a TreeIcon-Item without cleaning the whole list and load it again!?
You could perhaps do it with a procedure like the following. I know this is an
example for a ListView gadget, but maybe something similar can be done with
ListIcons or TreeIcons...?

Code: Select all

If OpenWindow(0,200,200,318,238,#PB_Window_SystemMenu,"Form1")=0 : End : EndIf
If InitGadget(2)=0 Or CreateGadgetList(WindowID())=0 : End : EndIf
;
#List1=1
  ListViewGadget(#List1,48,80,209,95)
  AddGadgetItem(#List1,-1,"1")
  AddGadgetItem(#List1,-1,"2")
  AddGadgetItem(#List1,-1,"3")
;
#Command1=2
  ButtonGadget(#Command1,48,24,209,33,"Click to change 2 to two")
;
Procedure ChangeItem(gadnum,item,new$)
  RemoveGadgetItem(gadnum,item-1)
  AddGadgetItem(gadnum,item-1,new$)
EndProcedure
;
Repeat
  EventID=WaitWindowEvent()
  Select EventID
    Case #PB_EventGadget
      Select EventGadgetID()
        Case #Command1 : ChangeItem(#List1,2,"two")
      EndSelect
  EndSelect
Until EventID=#PB_EventCloseWindow

PB - Registered PureBasic Coder

Edited by - PB on 05 January 2002 20:41:04
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by tranquil.

Thanks PB for this hint. You are right, that is one way how to do it.

But it is not the perfect one. :)

Anyway, it would be nice to attach a complete array to a ListIconGadget.
For example: AddGadgetList(#gadget,array()) where the list is changed when
I change an entry of the assigned array. Fred, is this possible!? For IconListGadget it should be possible to add an array defined through a structure, so that it is possible to add/change the image or more...
Hope someone understand my little school english. :)

Tranquilizer/ Secretly!
Registred PureBasic User
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Rings.

Yes a missing feature, i post it in the wishlists

Siggi
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by redacid.

What I`d like to have: a solution like that in BlitzBasic-Amiga. There you have to use a LinkedList for the items of the ListView. If you change an item you will only have to call one command - and not a whole selfmade function...

(Fred: you know what I mean?!)

regards,
Redacid
---
Only Amiga makes it possible!

Edited by - redacid on 06 January 2002 09:06:42
Post Reply