Page 1 of 1

teechart "invalid pointer operation"

Posted: Sat Apr 01, 2017 1:09 am
by 16680169

Code: Select all

void CMainView::new_inputdata(long in_chartcnt, float in_heights, float in_depth, float in_heights_ddepth, float in_shiftin, float in_shiftright])
    {

    SYSTEMTIME  cur_time;
CString str, tmp;


::GetLocalTime(&cur_time);


SerHeight = m_tchart1.Series(0);
SerHeightDepth = m_tchart1.Series(1);
SerDepth = m_tchart2.Series(0);
SerShiftIn = m_tchart3.Series(0);
SerShiftRight = m_tchart3.Series(1);

if (in_chartcnt < 3600)
{

    str.Format("%02d:%02d:%02d", cur_time.wHour, cur_time.wMinute, cur_time.wSecond);
    SerHeight.AddXY(in_chartcnt, in_heights, str, in_chartcnt);
    SerHeightDepth.AddXY(in_chartcnt, in_heights_ddepth, "", in_chartcnt);
    SerDepth.AddXY(in_chartcnt, in_depth, str, in_depth);
    SerShiftIn.AddXY(in_chartcnt, in_shiftin, str, in_shiftin);
    SerShiftRight.AddXY(in_chartcnt, in_shiftright, "", in_shiftright);

    SerHeight.GetXValues().SetDateTime(TRUE);
    SerDepth.GetXValues().SetDateTime(TRUE);
    SerShiftIn.GetXValues().SetDateTime(TRUE);


    // height chart;

    if (in_chartcnt >= 540)
    {
        SendMessage(WM_MOVESCROLL, 0, 0); // scroll scrollbar
    }
}
else
{


    yvallistHeight = SerHeight.GetYValues(); // height 
    yvallistHeightDepth = SerHeightDepth.GetYValues(); // height -depth 
    yvallistDepth = SerDepth.GetYValues(); // depth 
    yvallistShiftIn = SerShiftIn.GetYValues(); // shiftin 
    yvallistShiftRight = SerShiftRight.GetYValues();//shift right
    for (int i = 0; i < (3660- 60)-1; i++)
    {
        // height chart

        double y1 = yvallistHeight.GetValue(i + 1);
        double y2 = yvallistHeightDepth.GetValue(i + 1);

        yvallistHeight.SetValue(i, yvallistHeight.GetValue(i + 1));
        yvallistHeightDepth.SetValue(i, yvallistHeightDepth.GetValue(i + 1));
        yvallistDepth.SetValue(i, yvallistDepth.GetValue(i + 1));
        yvallistShiftIn.SetValue(i, yvallistShiftIn.GetValue(i + 1));
        yvallistShiftRight.SetValue(i, yvallistShiftRight.GetValue(i + 1));
        SerHeight.SetPointLabel(i, SerHeight.GetPointLabel(i + 1));
        SerDepth.SetPointLabel(i, SerDepth.GetPointLabel(i + 1));
        SerShiftIn.SetPointLabel(i, SerShiftIn.GetPointLabel(i + 1));
        // height chart

    }

    str.Format(%02d:%02d:%02d", cur_time.wHour, cur_time.wMinute, cur_time.wSecond);

    yvallistHeight.SetValue(3599, in_heights);
    yvallistHeightDepth.SetValue(3599, in_heights_ddepth);
    yvallistDepth.SetValue(3599, in_depth);
    yvallistShiftIn.SetValue(3599, in_shiftin);
    yvallistShiftRight.SetValue(3599, in_shiftright);

    SerHeight.SetPointLabel(3599, str);
    SerDepth.SetPointLabel(3599, str);
    SerShiftIn.SetPointLabel(3599, str);



    SerHeight.GetXValues().SetDateTime(TRUE);
    SerDepth.GetXValues().SetDateTime(TRUE);
    SerShiftIn.GetXValues().SetDateTime(TRUE);

    }

    return;
}
teechart is got error message "invalid pointer operation"

this method in repeat 1 sec.

Re: teechart "invalid pointer operation"

Posted: Tue Apr 04, 2017 7:50 am
by yeray
Hello,

Could you please arrange a simple example project we can run as-is to reproduce the problem here?
Thanks in advance.