多列切换器有没有办法防止在运行多个列切换器时选择同一列?
dt = open("$SAMPLE_DATA/Candy Bars.jmp");
biv = dt << Bivariate(
Y( :Saturated fat g ),
X( :Sugars g ),
SendToReport( Dispatch( {}, "Bivar Plot", FrameBox, {Frame Size( 593, 564 )} ) )
);
cs1 = biv << Column Switcher(
:Saturated fat g,
{:Name( "Serving/pkg" ), :Calories, :Total fat g, :Saturated fat g,
:Cholesterol g, :Sodium mg, :Carbohydrate g, :Dietary fiber g, :Sugars g,
:Protein g, :Vitamin A %RDI, :Vitamin C %RDI, :Calcium %RDI, :Iron %RDI}
);
cs2 = biv << Column Switcher(
:Sugars g,
{:Name( "Oz/pkg" ), :Calories, :Total fat g, :Saturated fat g,
:Cholesterol g, :Sodium mg, :Carbohydrate g, :Dietary fiber g, :Sugars g,
:Protein g, :Vitamin A %RDI, :Iron %RDI}
);
cs1 << Run;
cs2 << Run;
如果让它运行足够长的时间,最终 cs2 会赶上 cs1 并抛出错误。由于现在列相同,cs1 和 cs2 失去了它们的 X/Y 依赖性,现在更改了两个参数。因此 X=Y 现在始终为真。
有人知道有什么解决方法吗?
回复:多列切换器这是按钮。这使用 Schedule() 运行动画并使用 setIcon() 获取图形。Write() 语句应该替换为更改变量的逻辑。OnClose 设置可见窗口,以便在可见窗口关闭时关闭调度程序窗口。

stop = 0; // animating state
loopFun = Function( {},
If( !stop,
Write( "go again\!n" ); // logic for animation
Schedule( .5, loopFun() ); // continue the animation 1/2 second later
)
);
New Window( "buttons",
<<ONCLOSE></ONCLOSE>
回复:多列切换器实际上,我使用 Col List Box 函数进行了格式化。但是,如果有人花一些时间尝试创建自定义播放和停止按钮,我将非常感谢您!
这是我为自定义切换器快速编写的代码,其中 xcolumns 和 ycolumns 是需要切换的列列表,dt 是数据表。
xnlines = If(nitems(xcolumns) > 15, 15, nitems(xcolumns));
ynlines = If(nitems(ycolumns) > 15, 15, nitems(ycolumns));
vlb << Append(hlb = Hlistbox(VlistBox(
Text Box("Column X"),
columnswitcherX = Col List Box(width(250), maxSelected(1), nlines(xnlines)),
Text Box("Column Y"),
columnswitcherY = Col List Box(width(250), maxSelected(1), nlines(ynlines)))));
columnswitcherX << Append(xcolumns);
columnswitcherY << Append(ycolumns);
columnswitcherX << Set Selected(1);
columnswitcherX << Set Script(
bivcolx = columnswitcherX << get selected;
bivcoly = columnswitcherY << get selected;
try(interactivebiv << Delete Box);
hlb << Append(interactivebiv = dt << Bivariate( X( Column(dtinteractive, bivcolx) ), Y( Column(dtinteractive, bivcoly) ), Fit Line( {Line Color( {213, 72, 87} )} )) )
);
columnswitcherY << Set Script(
bivcolx = columnswitcherX << get selected;
bivcoly = columnswitcherY << get selected;
try(interactivebiv << Delete Box);
hlb << Append(interactivebiv = dt << Bivariate( X( Column(dtinteractive, bivcolx) ), Y( Column(dtinteractive, bivcoly) ), Fit Line( {Line Color( {213, 72, 87} )} )) )
);
columnswitcherY << Set Selected(1);
回复:多列切换器<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />所以,我已经这样做了,但由于列名相当长,我无法让它们在列表框中正确格式化。您知道如何使它们像在列切换器中那样显示吗?(第一部分......最后部分)?
回复:多列切换器这是列切换器的一个令人恼火的限制。解决方法是不使用列切换器,而是使用列表框(或组合框)自行实现该功能。将一个脚本附加到这些列表框,该脚本将删除二元图并添加基于列表框选择创建一个新图。