// in .h file:
ArrayCtrl wraparray;
...
// somewhere in code initialization:
wraparray.AddColumn().Ctrls(THISBACK(CreateDocEdit));
...
// DocEdit factory callback:
MyProg::CreateDocEdit(One<Ctrl>& x)
{
x.Create<DocEdit>().NoBackground().SetFrame(NullFrame()).Disable();
}
...
// Adding rows: here's where I guess things go wrong!
void MyProg::AddRowsToWrapArray(Vector<Value>& rows)
{
int line, cy_height;
const int FONT_HEIGHT = GetTextSize("text sample", GetStdFont()).cy;
// this is weird, but necessary, or last included row won't show properly:
if(wraparray.GetCount() > 0)
wraparray.Remove(wraparray.GetCount() - 1);
for(int ix = 0; ix < rows.GetCount(); ix ++) {
wraparray.Add(rows[ix]);
line = wraparray.GetCount() - 1;
DocEdit * de = (DocEdit*)wraparray.GetCtrl(line, 0);
cy_height = (de->GetLineCount() + 1)*FONT_HEIGHT;
de->SetRectY(0, cy_height);
wraparray.SetLineCy(line, cy_height);
de->RefreshLayout();
}
// this is weird, but necessary, or last included row won't show properly:
wraparray.Add();
}