Try something simpler like this:

> while(pInventory)
> {
> const char *pToken = pInventory->GetString("name");
>                 const char *pName = Items->GetInvItemName(pToken);
>
>                 DevMsg("name: %s\n", pName);
                        KeyValues *pKV = new KeyValues( "entry" );
                        pKV->SetString( "localized", pName );
>
>                 m_pInventory->AddItem(pKV, 0, false, false);
>
                        pKV->deleteThis();
>                 pInventory = pInventory->GetNextKey(); }
>

Can you also send the code snippet for the construction of the
listpanel.



- Alfred

----Original Message----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Kamran
Sent: Wednesday, August 10, 2005 6:13 PM To: HLCoders
Subject: [hlcoders] Updating KeyValues when iterating

> I'm adding items to a ListPanel and I iterate through a KeyValues
> object. Works fine, except:
>
> while(pInventory)
> {
> const char *pToken = pInventory->GetString("name");
>                 const char *pName = Items->GetInvItemName(pToken);
>
>                 DevMsg("name: %s\n", pName);
>
>                 // Set name
>                 pInventory->SetString("localized", pName);
>
>                 m_pInventory->AddItem(pInventory, 0, false, false);
>
>                 pInventory = pInventory->GetNextKey(); }
>
> When it displays it, it just has a "t" character. But the dev msg
> displays it fine. I've also tried creating a different KV object and
> assigning it, but that doesn't work either.

_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders

Reply via email to