My guess is that m_pPrimaryWeaponComboBox[m_iPlayerLoadoutPanel] is a NULL
pointer. Your best bet is to set a breakpoint there and see what the value
of the pointer is. Chances are your m_iPlayerLoadoutPanel is a incorrect
value, try replacing it with CLASSLOADOUT_RIFLEMAN to see.

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of NuclearFriend
Sent: Monday, March 21, 2005 5: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

Reply via email to