Home » U++ Library support » RichText,QTF,RTF... » How to use QTF/RichText with support of links as node of TreeCtrl?
How to use QTF/RichText with support of links as node of TreeCtrl? [message #19298] |
Mon, 24 November 2008 20:35 |
Novo
Messages: 1358 Registered: December 2006
|
Ultimate Contributor |
|
|
What is the best way of using QTF/RichText with support of links as node of TreeCtrl?
SetDisplay(QTFDisplay()) helps to display QTF, but it doesn’t allow to work with links, and it seems to be an inefficient way to display QTF because it calls ParseQTF() in GetStdSize(),RatioSize(), and Paint() methods. Direct using of RichText would be a more efficient way.
I’ve tried to use RichTextCtrl for this purpose. Unfortunately, I couldn’t figure out how to calculate correct size of a control to pass it to a TreeCtrl::Node.
Any help will be appreciated.
Thanks.
Regards,
Novo
|
|
|
|
Re: How to use QTF/RichText with support of links as node of TreeCtrl? [message #19322 is a reply to message #19316] |
Wed, 26 November 2008 06:41 |
Novo
Messages: 1358 Registered: December 2006
|
Ultimate Contributor |
|
|
Thanks.
I've tried that way. Unfortunately, it is not working for me.
Array<RichTextCtrl> rt_ctrl;
TreeCtrl wtree;
rt_ctrl.Add().SetZoom(Zoom(1, 7)).NoSb().SetQTF(qtf_text);
int x = rt_ctrl.Top().GetWidth();
Size sz(x, rt_ctrl.Top().GetHeight(x));
wtree.Add(parent_id, TreeCtrl::Node(rt_ctrl.Top()).SetSize(sz));
The size is bigger, probably, because of zooming.
QTFDisplay() makes magic with ApplyZoom.
RichText rtext = ParseQTF(s);
rtext.ApplyZoom(GetRichTextStdScreenZoom());
draw.DrawRect(r, paper);
There is no ApplyZoom in RichTextCtrl. GetMinSize()/GetMaxSize() are not working either.
I'm definitely missing something.
Regards,
Novo
[Updated on: Wed, 26 November 2008 06:44] Report message to a moderator
|
|
|
Re: How to use QTF/RichText with support of links as node of TreeCtrl? [message #19346 is a reply to message #19322] |
Fri, 28 November 2008 07:16 |
Novo
Messages: 1358 Registered: December 2006
|
Ultimate Contributor |
|
|
I finally figured out how to calculate correct size of a RichTextCtrl.
rt_ctrl.Add().SetZoom(Zoom(1, 7)).NoSb().SetQTF(qtf_text);
int x = rt_ctrl.Top().GetWidth();
Size sz(x, rt_ctrl.Top().GetHeight(x));
sz /= 7;
sz.cx += 1;
It seems a little strange that I need to apply zooming to the size manually.
Another question.
Is there an example how to paint selected node with RichTextCtrl?
I mean background with correct color.
TIA
Regards,
Novo
|
|
|
|
Re: How to use QTF/RichText with support of links as node of TreeCtrl? [message #19398 is a reply to message #19369] |
Mon, 01 December 2008 04:01 |
Novo
Messages: 1358 Registered: December 2006
|
Ultimate Contributor |
|
|
luzr wrote on Sat, 29 November 2008 07:14 |
I am not sure it is easily possible. In fact, background is less problem (Transparent + SetBackground(Null)), but the real problem is text color....
Mirek
|
I've tried $N with QTF and Background(Null) with RichTextView. Unfortunately, that didn't help.
In QTFDisplayCls::Paint you do that in a different way:
s << "[@(" << ink.GetR() << "." << ink.GetG() << "." << ink.GetB() << ") " << v;
@ is supposed to define a text color. So, I'm a somewhat lost.
Regards,
Novo
|
|
|
|
Goto Forum:
Current Time: Wed May 15 05:43:48 CEST 2024
Total time taken to generate the page: 0.02552 seconds
|