hi, everyone... i have problem to fill second column in a tree control... the cells are editables, but the first column is edited and i get error on second columns index???!!
my codes are as follow:
int CVICALLBACK startCB (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{
double xn[100]={0.0}, sine[200];
double x[200]={0.0}, y[200]={0.0};
double amp=1.0, cycle=0.25;
int i,j,k=2;
char sx[100], sy[100];
switch (event)
{
case EVENT_COMMIT:
InsertTreeColumn (panelHandle, PANEL_TREE, 1, NULL);
SetTreeColumnAttribute (panelHandle, PANEL_TREE, 0, ATTR_LABEL_TEXT, "X Value");
SetTreeColumnAttribute (panelHandle, PANEL_TREE, VAL_ALL_OBJECTS, ATTR_COLUMN_VISIBLE, 1);
SetTreeColumnAttribute (panelHandle, PANEL_TREE, 1, ATTR_LABEL_TEXT, "Y Value");
SetTreeColumnAttribute (panelHandle, PANEL_TREE, VAL_ALL_OBJECTS, ATTR_COLUMN_VISIBLE, 1);
for(i=0;i<100;++i)
sine[i]=amp*sin(sqrt(2*PI*i*cycle/100));
i=2;
xn[i-2]=0.0;
xn[i-1]=amp*sin(sqrt(2*PI*cycle/100+xn[i-2]));
while((xn[i-1]-xn[i-2]) >0.00001){
xn[i]=amp*sin(sqrt(xn[i-1]));
sprintf(sx,"%.5f",xn[i-1]);
sprintf(sy,"%.5f",xn[i]);
++i;
SetTreeCellAttribute (panelHandle, PANEL_TREE, VAL_ALL_OBJECTS, 0, ATTR_CELL_TYPE, VAL_CELL_STRING);
InsertTreeItem (panelHandle, PANEL_TREE, VAL_SIBLING, 0, VAL_LAST, sx, NULL, NULL, xn[i-1]);
SetTreeCellAttribute (panelHandle, PANEL_TREE, VAL_ALL_OBJECTS, 1, ATTR_CELL_TYPE, VAL_CELL_STRING);
InsertTreeItem (panelHandle, PANEL_TREE, VAL_SIBLING, 1, VAL_LAST, sy, NULL, NULL, xn[i]);
}
x[0]=0.02; x[1]=0.02; y[0]=0.02; y[1]=sine[2];
for(j=2;j<100;j+=2){
x[k]=y[j-1];
y[k]=y[j-1];
x[k+1]=y[j-1];
y[k+1]=amp*sin(sqrt(2*PI*y[j]*cycle));
k+=2;
}
PlotLine (panelHandle, PANEL_GRAPH, 0, 0, 1, 1, VAL_GREEN);
PlotWaveform (panelHandle, PANEL_GRAPH, sine, 100, VAL_DOUBLE, 1.0, 0.0, 0.0, 0.01, VAL_THIN_LINE, VAL_EMPTY_SQUARE, VAL_SOLID, 1, VAL_RED);
PlotXY (panelHandle, PANEL_GRAPH, x, y, i-1, VAL_DOUBLE, VAL_DOUBLE, VAL_THIN_LINE, VAL_EMPTY_SQUARE, VAL_DASH, 1, VAL_YELLOW);
break;
case EVENT_ZOOM:
SetCtrlAttribute (panelHandle, PANEL_GRAPH, ATTR_ENABLE_ZOOM_AND_PAN, 1);
SetCtrlAttribute (panelHandle, PANEL_GRAPH, ATTR_ZOOM_STYLE, VAL_ZOOM_TO_RECT);
break;
}
return 0;
}
it doesnt like the 1, as second columns index in the following code:
InsertTreeItem (panelHandle, PANEL_TREE, VAL_SIBLING, 1, VAL_LAST, sy, NULL, NULL, xn[i]);
why i cannot find the reason... can anybody help me out? thanks snd kind regards