New line in the header caption

TeeChart for ActiveX, COM and ASP
Post Reply
n00b
Newbie
Newbie
Posts: 8
Joined: Mon Nov 30, 2009 12:00 am

New line in the header caption

Post by n00b » Thu Mar 18, 2010 12:27 am

We're using TeeChart in conjunction with user selectable filters.

My boss wants to print the filters as part of the heading or a subheading so that users can easily see what filters are being applied.

Seeing that there aren't any sub-headings, I'm trying to display the filters underneath the main heading through the use of a new line; however the SetCaption method doesn't seem to accept "\n" as a new line character.

Is there some setting I need to enable to accept "\n"? Or are there better alternatives that I'm not aware of?

Thanks!

Yeray
Site Admin
Site Admin
Posts: 9614
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: New line in the header caption

Post by Yeray » Fri Mar 19, 2010 2:53 pm

Hi n00b,

In what language are you programming?
Here in VB6, if I understand well what you want to do, you can do as follows:

Code: Select all

TChart1.Header.Text.Text = "hello" + vbNewLine + "world"
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

n00b
Newbie
Newbie
Posts: 8
Joined: Mon Nov 30, 2009 12:00 am

Re: New line in the header caption

Post by n00b » Sun Mar 21, 2010 11:41 pm

Hi Yeray,

I'm coding this in C++. I would have thought that \n would have been the equivalent of VBs vbNewLine but it doesn't seem to work.

Code: Select all


CString sHeader = "First Line" + "\nSecond Line";
m_wndChart.GetHeader().SetCaption(sHeader);

That will come out as

First LineSecond Line

instead of:

First Line
Second Line

Yeray
Site Admin
Site Admin
Posts: 9614
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: New line in the header caption

Post by Yeray » Tue Mar 23, 2010 2:28 pm

Hi n00b,

The following code works fine here in Microsoft Visual C++ 6:

Code: Select all

m_Chart1.GetHeader().GetText().SetText("First Line\nSecond Line");
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

n00b
Newbie
Newbie
Posts: 8
Joined: Mon Nov 30, 2009 12:00 am

Re: New line in the header caption

Post by n00b » Wed Mar 24, 2010 4:44 am

That worked perfectly!

Thanks Yeray!

Post Reply