Page 1 of 1

Posted: Sun Nov 03, 2002 11:50 pm
by BackupUser
Restored from previous forum. Originally posted by Kale.

I have a linkedlist created using a simple structure:

Code: Select all

Structure debitStructure
    name.s
    date.s
    cost.s
EndStructure
NewList debitList.debitStructure()
then this is populated with strings read from a preference file:

Code: Select all

If OpenPreferences("debits.prefs")
    PreferenceGroup("amount")
        maxDebits = ReadPreferenceLong("number", 0)
    For x=1 To maxDebits
        PreferenceGroup("debit"+Str(x))
            AddElement(debitList())
                debitList()\name = ReadPreferenceString("name", "Error...")
                debitList()\date = ReadPreferenceString("date", "Error...")
                debitList()\cost = ReadPreferenceString("cost", "Error...")
    Next
    ClosePreferences()
EndIf
with me? right. then i try to populate a ListIconGadget with the following code:

Code: Select all

Procedure updateListBox()
    FirstElement(debitList())
    For x=1 To maxDebits
        rowString.s = debitList()\name+Chr(10)+addDateSuffix(debitList()\date)+Chr(10)+debitList()\cost+Chr(10)+updateDaysLeft(debitList()\date)
        AddGadgetItem(#LIST_BOX, x, rowString)
        NextElement(debitList())
    Next
EndProcedure
the problem is that only the first column is being populated! i have added the chr(10)'s to seperate the text for each column, but the text seems to dissapear. If you add Debug rowString it reports the correct string? any ideas?

thanks,

Posted: Sun Nov 03, 2002 11:59 pm
by BackupUser
Restored from previous forum. Originally posted by PB.

> AddGadgetItem(#LIST_BOX, x, rowString)

Shouldn't this line be...

AddGadgetItem(#LIST_BOX, -1, rowString)

...to fill the list? I haven't used listboxes myself, so I'm assuming
that you only use numbers bigger than -1 when inserting items, and not
when adding them? Can anyone confirm this for me (and Kale) please?


PB - Registered PureBasic Coder

Posted: Mon Nov 04, 2002 12:08 am
by BackupUser
Restored from previous forum. Originally posted by Kale.

wow that was quick PB :) and yes that did sort out my problem, thankyou very much! i think i need sleep.....ZZzzz..

--Kale
[url]mailto:sab@freeuk.com[/url]


New to PureBasic and falling in Love! :)
AMD XP2100+, Geforce4Ti 4400, 512Mb DDR, Abit KX7, WinXP Pro