Hi,
From a table with two columns defining X and Y coordinates, I'm trying to create a graph box with an interactive handle for each point defined in the table. Adding handles one by one (see nw1 below) works perfectly, but when I try to automate the process by using ForEachRow or a For loop (see nw2 and nw3), I get a graph box with the points, but they can't be moved interactively. What would be the correct way to automate the creation of the handles?
Thanks, Étienne
dt = NewTable("DataPoints", AddRows(3),
NewColumn("xVar", Numeric, "Continuous", SetValues( [1, 2, 3])),
NewColumn("yVar", Numeric, "Continuous", SetValues( [1, 2, 3]))
);
CurrentDataTable(dt);
nw1 = NewWindow("Example 1",
gr1 = GraphBox(
FrameSize(400, 400), XScale(0, 5), YScale(0, 5),
Handle(:xVar[1], :yVar[1], :xVar[1] = x; :yVar[1] = y;);
Handle(:xVar[2], :yVar[2], :xVar[2] = x; :yVar[2] = y;);
Handle(:xVar[3], :yVar[3], :xVar[3] = x; :yVar[3] = y;);
);
);
nw2 = NewWindow("Example 2",
gr2 = GraphBox(
FrameSize(400, 400), XScale(0, 5), YScale(0, 5),
ForEachRow(
Handle(:xVar, :yVar, :xVar = x; :yVar = y;);
);
);
);
nw3 = NewWindow("Example 3",
gr3 = GraphBox(
FrameSize(400, 400), XScale(0, 5), YScale(0, 5),
For(i=1, i<=NRows(dt), i++,
Handle(:xVar[i], :yVar[i], :xVar[i] = x; :yVar[i] = y;);
);
);
);