my mistake! it is not a pointer/pointer map!
Code:
class paramEditor : public TPanel
{
public:
paramEditor(TobjectEditor *Owner,parameter *param);
void __fastcall setParam(TObject *Sender);
void __fastcall resetEditColor(TObject *Sender);
TLabel *title;
TLabel *currentValue;
TEdit *edit;
parameter *param;
};
void loadParams(paramSet *pset)
{
clearParams(); //frees elements of params
std::map<String,parameter *>::iterator it = pset->params.begin();
while(it!=pset->params.end())
{
params.Length++;
paramEditor *p =new paramEditor(this,it->second);
params[params.High]=p;
++it;
}
}
void setParams()
{
for(int i=0;i<params.Length;i++)
{
params[i]->setParam(); // passes value of text field into function that validates / casts text into appropriate data type
}
loadParams();
}
i realize there are lots of pointers here, so before you start asking why: my compiler requires it for any object descended from their VCL framework. otherwise, you get a compile time error saying "VCL style classes must be instantiated with operator new". all of their framework uses pointers, so it's really just more efficient to keep everything under 1 layer of indirection rather than constantly addressing and dereferencing everything.
i'd rather not post the entire src, but here are snippets of the relevant parts.
the only reason for using a map instead of an array for paramSet is the alphabetizing.
params is a DynamicArray<paramEditor *> member of the objEditor, which is the form that houses all this.
parameters whose values are altered during setParam will not show up in the same order the next time loadParams is called.