Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » ArrayCtrl, HeaderCtrl & GridCtrl » Wrapping text in ArrayCtrl cells
Re: Wrapping text in ArrayCtrl cells [message #31106 is a reply to message #31103] Fri, 04 February 2011 20:06 Go to previous messageGo to previous message
bushman is currently offline  bushman
Messages: 134
Registered: February 2009
Experienced Member
I guess I found a solution to this issue myself; I'm using RichTextCtrl's instead of DocEdit's:
// 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();
	}
}


It works perfectly!
Thank you.
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: GridCtrl with Option problem under linux
Next Topic: Newbie question: ArrayCtrl::IsModified(int ii) not work at expected.
Goto Forum:
  


Current Time: Wed May 14 02:22:44 CEST 2025

Total time taken to generate the page: 0.02984 seconds