ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  ChartDirector 7
Posted by Ian on May-26-2021 18:43
Attachments:
Hi Peter,

I'm having an issue with ChartDirector7.0. I rebuilt by app using the later version. I am trying to draw a WindRose using the line:

PolarChart *c = new PolarChart(sizeW, sizeH, m_iBgColour, Chart::Transparent, 0);

// Draw the top left and bottom right text as per gadgets
if (!m_szTopText.IsEmpty())
{
       TextBox *pTopLeft = c->addText(0, 0, m_szTopText, m_szAuxFontFileName, (double)m_iAuxFontPointSize,                      m_iAuxFontColour, Chart::TopLeft, 0.0);
        pTopLeft->setMargin(0, 0, 0, 0);
}

When I execute the addText I get:Please see attached file ChartError.png


I break at (in chartdir.h):
TextBox *addText(int x, int y, const char *text, const char *font = 0, double fontSize = 8,
int fontColor = Chart::TextColor, int alignment = Chart::TopLeft, double angle = 0, bool vertical = false)
{ TextBox *ret = new TextBox(CBaseChart_addText(ptr, x, y, text, font, fontSize, fontColor, alignment, angle, vertical)); reg(ret); return ret; }

Can you please advise,
Regards
ChartError.PNG

  Re: ChartDirector 7
Posted by Peter Kwan on May-26-2021 21:07
Hi Ian,

I assume you are using the new ChartDirector 7.0 header files with chartdir70.lib/chartdir70.dll, and not the old ChartDirector header files.

The 0xCDCDCDCD error usually means the pointers are located in unallocated memory. When you compile code in Debug mode, the runtime will fill unallocated or memory that is released with 0xCDCDCDCD, and initialize allocated memory to 0. (In Release mode, the memory should contain random values.) So if a pointer has the value 0xCDCDCDCD. it is in unallocated memory.

To trouble-shoot the problem, is it possible to replace all your variables with hard coded values, so we can be sure they are not in invalid memory?

May be you can try the followings. This will display the values of m_szTopText and m_szAuxFontFileName in the output window in Visual Studio. The parameters to addText are changed to hard coded values to make sure they are valid. Please try if this can work.

if (!m_szTopText.IsEmpty())
{
    TRACE("text = %sn", (LPCTSTR)(m_szTopText));
    TRACE("font = %sn", (LPCTSTR)(m_szAuxFontFileName));

    TextBox* pTopLeft = c->addText(0, 0, "abcd", "arialbd.ttf", (double)12, 0xff0000, Chart::TopLeft, 0.0);
    pTopLeft->setMargin(0, 0, 0, 0);
}


Regards
Peter Kwan