列表框显示所有打开的表格我正在尝试构建一个列表框,它列出所有打开的数据表,并使用新打开/新关闭的表自动更新。 我已经开始使用下面的脚本,但由于某种原因 onClose 函数不起作用。
感谢帮助:)
names default to here(1);
f1 = function ({Temp_list},
T_list = Temp_list << get name();
lb << remove all;
lb << append (T_list)
);
f2 = function ({Temp_list},
T_list = Temp_list << get name();
lb << remove all;
lb << append (T_list)
);
asub = Subscribe to data table list( , onopen(f1));
Subscribe to data table list(asub , onclose(f2));
nw = new window("Trial",show menu(0),
vlistbox(
T_list = get data table list ();
lb = listbox(T_list);
)
);
脚本编写回复:列表框显示所有打开的表格使用下面的 JSL,这是我发现的。
Names Default To Here( 1 );
f2 = Function( {Temp_list},
T_list = Get Data Table List();
lb << remove all;
lb << append( T_list );
show("Close");
);
f1 = Function( {Temp_list},
T_list = Get Data Table List();
lb << remove all;
lb << append( T_list );
show("add");
);
asub = Subscribe to Data Table List( , onopen( f1 ) );
Subscribe to Data Table List(asub , onclose( f2 ) );
nw = New Window( "Trial",
Show Menu( 0 ),
V List Box(
T_list = Get Data Table List();
lb = List Box( T_list );
)
);
- 创建的列表框将无错误地添加新数据表。
- f1 函数每次加法执行一次
- 如果关闭数据表,它不会从列表框中删除。
- 如果关闭第二个数据表,先前关闭的数据表将从列表框中删除。
- 如果关闭列表框并再次运行 JSL,并关闭数据表,则 f2 函数将运行两次。将运行第一次运行 JSL 的 f2 函数,然后运行 f2 函数的第二个实例。这可以通过更改 Show() 语句来显示。如果 Show 语句从
Show( "Close" );
到Show( "Close 2" );
关闭数据表时,将显示 Show() 语句的两个版本,
- JSL 的后续执行添加了 f2 函数的额外副本,每个副本都会为每个数据表关闭而执行。
- Clear Globals 和 Clear Symbols 不会消除之前版本的 f2 函数。
这显然是一个 JMP 错误,需要发送给 JMP 支持人员。
我已将错误提交给他们。
回复:列表框显示所有打开的表格谢谢@txnelson !! 这正是我遇到的错误。 我想与此同时,我必须为此找到解决方法。
回复:列表框显示所有打开的表格您应该能够向 lb 添加新值,并且它们仅删除带有索引的封闭值(使用 Contains() 获取索引)还向函数添加了局部变量。
Names Default To Here(1);
f1 = function ({Temp_list}, {tableList},
tableList = Temp_list << get name();
lb << append (tableList)
);
f2 = function ({Temp_list}, {tableList},
tableList = Temp_list << get name();
lb << Remove Item(Contains(lb << get items, tableList));
);
asub = Subscribe to data table list( , onopen(f1));
Subscribe to data table list(asub , OnClose(f2));
nw = new window("Trial",show menu(0),
vlistbox(
lb = listbox(get data table list ());
)
);回复:显示所有打开表的列表框谢谢@jthi ! 这样可行!
如果您不介意,您能否也展示一下如何设置“OnRename”子句?