ListIconGadget - how to cycle through [Solved]

Just starting out? Need help? Post your questions and find answers here.
superjacent
User
User
Posts: 27
Joined: Mon Oct 01, 2007 1:38 pm
Location: Melbourne, Australia
Contact:

ListIconGadget - how to cycle through [Solved]

Post 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.
Last edited by superjacent on Sun Jul 20, 2008 12:48 pm, edited 1 time in total.
milan1612
Addict
Addict
Posts: 894
Joined: Thu Apr 05, 2007 12:15 am
Location: Nuremberg, Germany
Contact:

Post 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"
Windows 7 & PureBasic 4.4
Marco2007
Enthusiast
Enthusiast
Posts: 648
Joined: Tue Jun 12, 2007 10:30 am
Location: not there...

Post 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).
PureBasic for Windows
milan1612
Addict
Addict
Posts: 894
Joined: Thu Apr 05, 2007 12:15 am
Location: Nuremberg, Germany
Contact:

Post 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
Windows 7 & PureBasic 4.4
superjacent
User
User
Posts: 27
Joined: Mon Oct 01, 2007 1:38 pm
Location: Melbourne, Australia
Contact:

Post by superjacent »

Thanks all, got that bit nutted out.
Post Reply