多列切換器有沒有辦法防止在運行多個列切換器時選擇同一列?
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" />所以,我已經這樣做了,但由於列名相當長,我無法讓它們在列錶框中正確格式化。您知道如何使它們像在列切換器中那樣顯示嗎?(第一部分......最後部分)?
回复:多列切換器這是列切換器的一個令人惱火的限制。解決方法是不使用列切換器,而是使用列錶框(或組合框)自行實現該功能。將一個腳本附加到這些列錶框,該腳本將刪除二元圖並添加基於列錶框選擇創建一個新圖。