Drop a memory breakpoint on m_pPrimaryWeaponComboBox (I,e its address for 4 bytes) and see what changes it.
- Alfred -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of NuclearFriend Sent: Monday, March 21, 2005 11:56 PM To: [email protected] Subject: Re: [hlcoders] ComboBox in VGUI2 Oops. m_pPrimaryWeaponComboBox[CLASSLOADOUT_RIFLEMAN]->AddItem("M1 Garand", primaryweapon); is now m_pPrimaryWeaponComboBox->AddItem("M1 Garand", primaryweapon); Just didn't want any unnecessary confusion. On Tue, 22 Mar 2005 18:55:07 +1100, NuclearFriend <[EMAIL PROTECTED]> wrote: > Ok, I added the vgui_controls lib to my project and got it debugging. > Which led me to discover that it isn't a problem within the control > itself, rather a problem with the pointer to the control. Because I > was worried that the extra 2 uninitialised elements in the array may > have been causing this weird pointer error, I made it a singular > pointer object. The results are as follows. At this point: > > m_pPrimaryWeaponComboBox[CLASSLOADOUT_RIFLEMAN]->AddItem("M1 Garand", > primaryweapon); > > The memory location of m_pPrimaryWeaponComboBox is 0x0f632978. > > At the point where I try to read the keyvalues of the active element, > the pointer is now 0x0f6346b8. > > I've never seen a pointer do this. Does anyone know the usual causes of this? > > Thanks for the help so far guys, hopefully we can get to the bottom of > this because I'm sure if I do it, others will too. ;) > > On Mon, 21 Mar 2005 16:25:48 -0800, Alfred Reynolds > <[EMAIL PROTECTED]> wrote: > > Rebuild the vgui_controls library (vgui2/controls) in debug and then > > run your mod again, you can see exactly what it breaking it then. > > > > - Alfred > > > > -----Original Message----- > > From: [EMAIL PROTECTED] > > [mailto:[EMAIL PROTECTED] On Behalf Of > > NuclearFriend > > Sent: Monday, March 21, 2005 3:38 PM > > To: [email protected] > > Subject: Re: [hlcoders] ComboBox in VGUI2 > > > > 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]->GetActiveItemUser > > > Data > > > () > > > ; > > > > > > 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 > > > > _______________________________________________ > > 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

