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 » RichText,QTF,RTF... » How to construct RichText without using QTF?
icon5.gif  How to construct RichText without using QTF? [message #23020] Tue, 08 September 2009 06:15 Go to next message
Novo is currently offline  Novo
Messages: 1358
Registered: December 2006
Ultimate Contributor
I'd like to develop a parser, which should construct a RichText object. It is supposed to be similar to ParseQtf. ParseQtf seems to be not very self explanatory.

Is there a simple example, which explains basic steps of RichText construction?

TIA


Regards,
Novo
Re: How to construct RichText without using QTF? [message #23048 is a reply to message #23020] Thu, 10 September 2009 14:31 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Novo wrote on Tue, 08 September 2009 00:15

I'd like to develop a parser, which should construct a RichText object. It is supposed to be similar to ParseQtf. ParseQtf seems to be not very self explanatory.

Is there a simple example, which explains basic steps of RichText construction?

TIA



ParseQtf and ParseRTF Smile

Maybe suggest what should the example do and I can provide it....

Mirek
Re: How to construct RichText without using QTF? [message #23058 is a reply to message #23048] Sat, 12 September 2009 18:40 Go to previous messageGo to next message
Novo is currently offline  Novo
Messages: 1358
Registered: December 2006
Ultimate Contributor
luzr wrote on Thu, 10 September 2009 08:31

Novo wrote on Tue, 08 September 2009 00:15

I'd like to develop a parser, which should construct a RichText object. It is supposed to be similar to ParseQtf. ParseQtf seems to be not very self explanatory.

Is there a simple example, which explains basic steps of RichText construction?

TIA



ParseQtf and ParseRTF Smile

Maybe suggest what should the example do and I can provide it....

Mirek


It would be nice to have an example, which produces output similar to http://www.ultimatepp.org/reference$Qtf.html.

It is not clear to me how to add a new line, for example ...

It would be nice to have explanation of relatinship among RichText, RichPara, and RichTextObject.

Actually, I tried to Cat() text into RichPara, and Cat() this RichPara into RichText after that. As a result, different pieces of text seem to overlap. Probably, this happens because my text contains characters, which are treated as control characters when RichText gets converted into string to be passed to RichTextView ...

TIA


Regards,
Novo
Re: How to construct RichText without using QTF? [message #23115 is a reply to message #23058] Thu, 17 September 2009 17:29 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Novo wrote on Sat, 12 September 2009 12:40

luzr wrote on Thu, 10 September 2009 08:31

Novo wrote on Tue, 08 September 2009 00:15

I'd like to develop a parser, which should construct a RichText object. It is supposed to be similar to ParseQtf. ParseQtf seems to be not very self explanatory.

Is there a simple example, which explains basic steps of RichText construction?

TIA



ParseQtf and ParseRTF Smile

Maybe suggest what should the example do and I can provide it....

Mirek


It would be nice to have an example, which produces output similar to http://www.ultimatepp.org/reference$Qtf.html.



Uh oh, that is quite long... Smile

Quote:


It is not clear to me how to add a new line, for example ...



Need to add new paragraph (RichPara).

OK, I will try to prepare something tonight...

Mirek
Re: How to construct RichText without using QTF? [message #23118 is a reply to message #23115] Thu, 17 September 2009 19:36 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
reference/RawRichText:

#include <CtrlLib/CtrlLib.h>

using namespace Upp;

GUI_APP_MAIN
{
	RichText txt;
	{
		RichPara para;
		RichPara::CharFormat fmt;
		(Font&)fmt = Serif(100);
		para.Cat("Hello world!", fmt);
		txt.Cat(para);
	}
	{
		RichPara para;
		{
			RichPara::CharFormat fmt;
			(Font&)fmt = Monospace(150).Bold();
			fmt.ink = Red;
			fmt.capitals = true;
			para.Cat("Monospace-bold-red-capitals, ", fmt);
		}
		{
			RichPara::CharFormat fmt;
			(Font&)fmt = SansSerif(100);
			fmt.link = "http://www.ultimatepp.org";
			para.Cat("This is some link", fmt);
		}
		txt.Cat(para);
	}
	{
		RichPara para;
		RichPara::CharFormat fmt;
		para.format.align = ALIGN_CENTER;
		para.Cat("Centered", fmt);
		txt.Cat(para);
	}
	{
		RichPara para;
		RichPara::CharFormat fmt;
		para.format.before = 100;
		para.format.lm = 300;
		para.Cat("Before and left margin", fmt);
		txt.Cat(para);
	}
	{
		RichPara para;
		RichPara::CharFormat fmt;
		RichObject obj = CreatePNGObject(CtrlImg::exclamation(), 200, 200);	
		para.Cat("Object: ", fmt);
		para.Cat(obj, fmt);
		txt.Cat(para);
	}
	{
		RichTable table;
		table.AddColumn(1);
		table.AddColumn(1);
		for(int i = 0; i < 3; i++)
			for(int j = 0; j < 2; j++) {
				RichText celltext;
				RichPara para;
				RichPara::CharFormat fmt;
				para.Cat(AsString(i) + ':' + AsString(j), fmt);
				celltext.Cat(para);
				table.SetPick(i, j, celltext);
			}
		txt.CatPick(table);
	}
	
	RichTextView view;
	view.Pick(txt);
	TopWindow win;
	win.Add(view.SizePos());
	win.Run();
}
Re: How to construct RichText without using QTF? [message #23151 is a reply to message #23118] Sat, 19 September 2009 04:28 Go to previous message
Novo is currently offline  Novo
Messages: 1358
Registered: December 2006
Ultimate Contributor
Thanks a lot!


Regards,
Novo
Previous Topic: Qtf to Html
Next Topic: QTF table borders disappering on Report/Perform()
Goto Forum:
  


Current Time: Fri Apr 19 22:45:22 CEST 2024

Total time taken to generate the page: 0.04876 seconds