Jump to content
Software FX Community

Annotation Objects in C++ won't show on chart


User (Legacy)

Recommended Posts

I'm trying to place a grid of text boxes across my chart in arbitrary

positions. I think I've got the code in correctly, using ArticleID:Q1371016

as my guideline. My problem is that the objects are never showing up on the

chart. I'm using WTL for the windowing and have the chart on a property

page.

/* Here's the source I'm using to initialize the annotation objects */

// In header: AnnotateX::IAnnListPtr m_pAnnList;

// I pulled the GUID from the .tlh because __uuidof( AnnotateX::AnnotateX )

was not working

// this way it appears to be creating properly and giving a valid pointer.

m_pAnnList.CreateInstance("{ef600d71-358f-11d1-8fd4-00aa00bd091c}");

m_pAnnList->ToolBar = FALSE;

m_pFX->AddExtension((IUnknown *)m_pAnnList);

/* And here's the code I'm using to display a test text box */

// declare the object

IAnnTextPtr pTextTest;

// create it (and add it to the chart?)

pTextTest = m_pAnnList->Add((short) AnnotateX::OBJECT_TYPE_TEXT);

// set some sample properties

pTextTest->Text = (BSTR) CComBSTR( "Test!" );

pTextTest->Top = .5 * m_dy;

pTextTest->Left = 3 * m_dx;

pTextTest->Width = m_dx;

pTextTest->Height = .5 * m_dy;

pTextTest->Color = RGB( 0x00, 0x00, 0x00 );

pTextTest->BkColor = CHART_TRANSPARENT;

pTextTest->SizeToFit();

pTextTest->Refresh( VARIANT_FALSE );

Thanks!

E

=================================

Eric R. Willeke

Software Engineer

Software Engineering Professionals, Inc.

655 W. Carmel Dr. Suite 100

Carmel, IN 46032

317-843-1640

=================================

Link to comment
Share on other sites

Nevermind - I found the problem.

It seems that when you call

m_pFX->ClearData( CD_ALLDATA );

it also removes any extensions added with AddExtension();

Basically I just need to change the order of my initialization.

--

"Eric Willeke" <erwilleke@sep.com> wrote in message

news:rOjr#JaUBHA.2432@webserver1.softwarefx.com...

> I'm trying to place a grid of text boxes across my chart in arbitrary

> positions. I think I've got the code in correctly, using

ArticleID:Q1371016

> as my guideline. My problem is that the objects are never showing up on

the

> chart. I'm using WTL for the windowing and have the chart on a property

> page.

>

> /* Here's the source I'm using to initialize the annotation objects */

>

> // In header: AnnotateX::IAnnListPtr m_pAnnList;

> // I pulled the GUID from the .tlh because __uuidof(

AnnotateX::AnnotateX )

> was not working

> // this way it appears to be creating properly and giving a valid pointer.

> m_pAnnList.CreateInstance("{ef600d71-358f-11d1-8fd4-00aa00bd091c}");

> m_pAnnList->ToolBar = FALSE;

> m_pFX->AddExtension((IUnknown *)m_pAnnList);

>

> /* And here's the code I'm using to display a test text box */

>

> // declare the object

> IAnnTextPtr pTextTest;

> // create it (and add it to the chart?)

> pTextTest = m_pAnnList->Add((short) AnnotateX::OBJECT_TYPE_TEXT);

>

> // set some sample properties

> pTextTest->Text = (BSTR) CComBSTR( "Test!" );

> pTextTest->Top = .5 * m_dy;

> pTextTest->Left = 3 * m_dx;

> pTextTest->Width = m_dx;

> pTextTest->Height = .5 * m_dy;

> pTextTest->Color = RGB( 0x00, 0x00, 0x00 );

> pTextTest->BkColor = CHART_TRANSPARENT;

> pTextTest->SizeToFit();

>

> pTextTest->Refresh( VARIANT_FALSE );

>

>

> Thanks!

> E

>

> =================================

> Eric R. Willeke

> Software Engineer

>

> Software Engineering Professionals, Inc.

> 655 W. Carmel Dr. Suite 100

> Carmel, IN 46032

> 317-843-1640

> =================================

>

>

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...