// this time around, wraparray ctrl factory callback creates RichTextCtrls instead: void MyProg::CreateRichText(One<Ctrl>& x) { x.Create<RichTextCtrl>().NoSb(); } void MyProg::AddRowsToWrapArray(Vector<Value>& rows) { int line, height; String str; for(int ix = 0; ix < rows.GetCount(); ix ++) { // enter cell text as QTF: str = "[G1 " + rows[ix].ToString() + "]"; // G => make sure StdFont is used wraparray.Add(str); line = wraparray.GetCount() - 1; // Get back pointer to cell RichTextCtrl RichTextCtrl * ra = (RichTextCtrl*)wraparray.GetCtrl(line, 0); // Here's da trick! height = ::GetSmartTextHeight("\1" + str, ra->GetRect().Width()); // "\1" => tell function it's QTF // resize both, RichTextCtrl and ArrayCtrl cell heights: ra->SetRectY(0, height); wraparray.SetLineCy(line, height); wraparray.RefreshLayoutDeep(); } }
Report message to a moderator