Home » U++ Library support » RichText,QTF,RTF... » How to construct RichText without using QTF?
How to construct RichText without using QTF? [message #23020] |
Tue, 08 September 2009 06:15  |
Novo
Messages: 1430 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 #23058 is a reply to message #23048] |
Sat, 12 September 2009 18:40   |
Novo
Messages: 1430 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 
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   |
 |
mirek
Messages: 14255 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 
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... 
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   |
 |
mirek
Messages: 14255 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();
}
|
|
|
|
Goto Forum:
Current Time: Fri Apr 25 19:04:50 CEST 2025
Total time taken to generate the page: 0.00486 seconds
|