Keep getting access violation exceptions

This commit is contained in:
andreja6
2018-10-22 22:01:46 -07:00
parent c71dcb8a91
commit 268a0cd2ee
5 changed files with 16 additions and 14 deletions

View File

@@ -33,14 +33,15 @@ void Update(PROPGRIDITEM)
void Instance::initProperties()
{
::PROPGRIDITEM pItem;
pItem.lpszCatalog="Test";
pItem.lpszPropName="Offset";
pItem.lpszzCmbItems="What";
pItem.lpszPropDesc="Description";
pItem.lpCurValue=(LPARAM)"0, 0, 0";
pItem.iItemType=PIT_EDIT;
properties.push_back(Property(pItem, Update));
PROPGRIDITEM * pItem = new PROPGRIDITEM();
pItem->lpszCatalog="Test";
pItem->lpszPropName="Offset";
pItem->lpszzCmbItems="What";
pItem->lpszPropDesc="Description";
pItem->lpCurValue=(LPARAM)"0, 0, 0";
pItem->iItemType=PIT_EDIT;
PropGrid_ItemInit((*pItem));
properties.push_back(new Property(pItem, Update));
}

View File

@@ -5,7 +5,7 @@
class Instance
{
public:
std::vector<Property> properties;
std::vector<Property *> properties;
Instance(void);
Instance(const Instance&);
virtual ~Instance(void);

View File

@@ -1,6 +1,6 @@
#include "Property.h"
Property::Property(PROPGRIDITEM item, void(*onPropUpdate)(PROPGRIDITEM))
Property::Property(PROPGRIDITEM * item, void(*onPropUpdate)(PROPGRIDITEM))
{
this->callbackFuncOnChange = onPropUpdate;
this->item = item;
@@ -8,6 +8,7 @@ Property::Property(PROPGRIDITEM item, void(*onPropUpdate)(PROPGRIDITEM))
Property::~Property(void)
{
delete item;
}
void Property::updateProperty(PROPGRIDITEM item)

View File

@@ -5,8 +5,8 @@ class Property
{
public:
void(*callbackFuncOnChange)(PROPGRIDITEM);
PROPGRIDITEM item;
Property(PROPGRIDITEM item, void(*onPropUpdate)(PROPGRIDITEM));
PROPGRIDITEM * item;
Property(PROPGRIDITEM * item, void(*onPropUpdate)(PROPGRIDITEM));
~Property(void);
void updateProperty(PROPGRIDITEM);
};

View File

@@ -111,10 +111,10 @@ void PropertyWindow::_redraw()
void PropertyWindow::SetProperties(Instance * instance)
{
PropGrid_ResetContent(_propGrid);
//PropGrid_ResetContent(_propGrid);
for(size_t i = 0; i < instance->properties.size(); i++)
{
PropGrid_AddItem(_propGrid, &instance->properties.at(i));
PropGrid_AddItem(_propGrid, instance->properties.at(i)->item);
}
SetWindowLongPtr(_propGrid,GWL_USERDATA,(LONG)this);
_redraw();