User (Legacy) Posted November 18, 1999 Report Share Posted November 18, 1999 Hello, I've been trying to set legends to series with the following code: for (int i = 0; i < 3; i++) { ICfxSeriesPtr pSerie = m_pChartFX->Series->Item[nSerie+i]; CString strLabel; strLabel.Format("%s - %s", pSection->GetName(), (i==0) ? "Major" : "Minor"); pSerie->Legend = (const char *)strLabel; } If I open a chart window all is well, the legend labels are there and everything works. But after I close the window, I cannot create another chart window. The function CreateControl fails. BUT! if I execute the following code: for (int i = 0; i < 3; i++) { ICfxSeriesPtr pSerie = m_pChartFX->Series->Item[nSerie+i]; pSerie->Legend = (const char *)pSection->GetName(); } I can create and close as many windows as I like, CreateControl never fails. Both the strLabel and the pSection->GetName() result in a CString object, so there's no difference there. At first I thought that the solution was in the scope of the variables, as pSection->GetName() is permanently active. So I created a static array of CString objects and used that to format the string and used that for the legend. Same difference. Then I used the CString::AllocSysString() which creates a BSTR object. No difference. And at the moment I'm out of options, but running against a deadline. Does anybody have a clue? Thanks! Rob Ursem Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.