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 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 Go to next message
Novo is currently offline  Novo
Messages: 765
Registered: December 2006
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 #19316 is a reply to message #19298] Tue, 25 November 2008 20:50 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 11843
Registered: November 2005
Ultimate Member
RichTextCtrl::Height, Width

Width returns maximal width, but that can be wider than available screen area.

Height returns the height for given width.

Mirek
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 Go to previous messageGo to next message
Novo is currently offline  Novo
Messages: 765
Registered: December 2006
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 Go to previous messageGo to next message
Novo is currently offline  Novo
Messages: 765
Registered: December 2006
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 #19369 is a reply to message #19346] Sat, 29 November 2008 13:14 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 11843
Registered: November 2005
Ultimate Member
Novo wrote on Fri, 28 November 2008 01:16

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.



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
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 Go to previous messageGo to next message
Novo is currently offline  Novo
Messages: 765
Registered: December 2006
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
Re: How to use QTF/RichText with support of links as node of TreeCtrl? [message #19488 is a reply to message #19398] Mon, 08 December 2008 05:21 Go to previous message
Novo is currently offline  Novo
Messages: 765
Registered: December 2006
Contributor
I've managed to get RichTextCtrl displayed and handled correctly (highlighted background of selected node) by fixing TreeCtrl::Paint.

http://www.ultimatepp.org/forum/index.php?t=msg&goto=194 87&#msg_19487



Regards,
Novo
Previous Topic: Enable Export to PDF in Report Example?
Next Topic: RichText editor problem..
Goto Forum:
  


Current Time: Thu Apr 25 00:10:01 CEST 2019

Total time taken to generate the page: 0.00898 seconds