Page 1 of 1

ListIconGadget - how to cycle through [Solved]

Posted: Sat Jul 19, 2008 10:09 am
by superjacent
I'm new to PB and for tutorial purposes I'm creating a simple batch file rename program.

I'm using the gadgets, ExplorerTree and ListIconGadget (for the multiple columns). So far I can navigate via the ExplorerTree gadget and populate the ListIconGadget with a listing of files (filename & date created). There is a third column "New Name" which initially is blank.

My question is, how do a cycle through the items in the ListIconGadget, for the life of me I couldn't find that in the help manual.

Next question, what is the best way to add data to the third column but retaining the same data in columns 1 & 2 (or 0 and 1 to be precise).

Any help appreciated.

Posted: Sat Jul 19, 2008 11:37 am
by milan1612
1.
Use CountGadgetItems() and GetGadgetItemText() to loop through all ListIcon items (with a For-Loop)
2.
Use SetGadgetItemText() with a combination of GetGadgetItemText() + Chr(9) + "Column 3"

Posted: Sat Jul 19, 2008 11:43 am
by Marco2007
milan1612 wrote:2.
Use SetGadgetItemText() with a combination of GetGadgetItemText() + Chr(9) + "Column 3"

Code: Select all

Setgadgetitemtext(#gadget, row, text.s, column)
should be enough.

Addgadgetitem needs chr(9).

Posted: Sat Jul 19, 2008 11:46 am
by milan1612
Marco2007 wrote:
milan1612 wrote:2.
Use SetGadgetItemText() with a combination of GetGadgetItemText() + Chr(9) + "Column 3"

Code: Select all

Setgadgetitemtext(#gadget, row, text.s, column)
should be enough.

Addgadgetitem needs chr(9).
Aye, I never saw this optional argument :P

EDIT:
Sample code for the first problem:

Code: Select all

For i = 0 To CountGadgetItems(#ListIcon) - 1
  Debug GetGadgetItemText(#ListIcon, i)
Next

Posted: Sat Jul 19, 2008 12:30 pm
by superjacent
Thanks all, got that bit nutted out.