When I said before the "combobox is fine" I meant the pointer was fine
when I try to call GetActiveItemUserData(). And no, primaryweapon is
left alone after it is initialised. ;(


On Mon, 21 Mar 2005 10:56:47 -0800, Alfred Reynolds
<[EMAIL PROTECTED]> wrote:
> Your not deleting primaryweapon after adding it to the combo are you?
>
> - Alfred
>
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of
> NuclearFriend
> Sent: Monday, March 21, 2005 3:12 AM
> To: [email protected]
> Subject: [hlcoders] ComboBox in VGUI2
>
> I need some help with utilising these neato little objects. I seem to be
> able to initialise them fine, they work fine in my panels. This is my
> initialisation code:
>
>         m_pPrimaryWeaponComboBox[CLASSLOADOUT_RIFLEMAN] = new
> ComboBox(m_pClassPanel[CLASSLOADOUT_RIFLEMAN], "PanelRifleman", 1,
> false);
>         m_pPrimaryWeaponComboBox[CLASSLOADOUT_RIFLEMAN]->SetPos(200,
> 100);
>         m_pPrimaryWeaponComboBox[CLASSLOADOUT_RIFLEMAN]->SetSize(200,
> 50);
>
> m_pPrimaryWeaponComboBox[CLASSLOADOUT_RIFLEMAN]->SetText("Primary
> Weapon");
>
>         KeyValues *primaryweapon = new KeyValues("primaryweapon");
>         primaryweapon->SetInt("primaryweapon", WEAPON_M1GARAND);
>         m_pPrimaryWeaponComboBox[CLASSLOADOUT_RIFLEMAN]->AddItem("M1
> Garand", primaryweapon);
>
> The problems occur when I try to recall the KeyValues of the active
> item:
>
>         KeyValues *temp =
> m_pPrimaryWeaponComboBox[m_iPlayerLoadoutPanel]->GetActiveItemUserData()
> ;
>
> This crashes with a pointer error. The combobox itself seems to be fine,
> most likely the pointer error is within the list of elements.
> Most member functions will crash the game ie GetItemCount().
>
> Has anyone else got these working? Am I forgetting something with my
> initialisation?
>
> PS This is a last resort, I have tried numerous things to get them
> working including looking at other examples in the code. Any help will
> be muchly appreciated. :>
>
> _______________________________________________
> To unsubscribe, edit your list preferences, or view the list archives,
> please visit:
> http://list.valvesoftware.com/mailman/listinfo/hlcoders
>
> _______________________________________________
> To unsubscribe, edit your list preferences, or view the list archives, please 
> visit:
> http://list.valvesoftware.com/mailman/listinfo/hlcoders
>
>

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

Reply via email to