我怎样才能让这里的错误消息消失?

当我在第一次绘制图形后通过“关闭窗口”按钮关闭表格和窗口时出现。 我复制了下面的脚本,但要运行它必须打开一个足够的数据表(见附件示例)。 在运行脚本时,应该打开这个表,并且只有这个表。 这个脚本是在编写报告、评估产品保质期等时尝试使用一个小的桌面稳定性计算器(非常脏,相当快)/帮助程序。 它允许用户将我们的标准化稳定性数据(其中 t=0 对应于 1000%rel。)应用于任何质量参数(只要它是数字)的假设起始浓度,并在设置和参数之间快速切换。 到目前为止我已经做到了,但是这个错误信息让我抓狂。 (另外,我可以在下一个节目中展示这个吗?面对面的北欧用户组:2022 年 10 月 5 日?)

Delete Symbols();
Names Default To Here( 1 );
dt = Current Data Table();
dt << Clear Row States;
dt << Clear Select; // avoids accidentally including columns in colList
// alpha level for bivariate plot
alpha = 0.1;
// get lists for model selection
Batch = Associative Array( dt:Batch ) << Get Keys; // direct column reference
For( i = 1, i <= N Row( dt ), i++, // find all rel% columns
For( j = 1, j <= N Col( dt ), j++,
If( Column( j )[i] == 0,
For( k = 1, k <= N Col( dt ), k++,
If( Column( k )[i] == 100,
Column( k ) << Set Selected( 1 )
)
)
)
)
);
colList = dt << Get Selected Columns;
// length of column list box
nItems = N Items( colList );
// radio box argument
rb1_expr = Expr(
dt << Clear Row States;
one_rb = rb1 << Get Selected;
dt << Select Where( (dt:Batch == one_rb) ); // direct column reference
dt << Invert Row Selection;
dt << Hide and Exclude;
dt << Invert Row Selection );
// "draw graph" button & column list selection arguments
action_expr = Expr(
vlb << Delete; // delete existing vlb
yColAbs = Eval(
Eval Expr(
dt << New Column( one_rb || " / " || " / " || "start level = " || Char( startLevel ) || " for " || Char( yColRel ),
formula( Expr(startLevel) / Expr(100) * (As Column( Expr( yColRel ) ) ) )
)
)
);
pb << Append( // append new vlb with fresh graph
vlb = V List Box(
biv = Bivariate(
Y( yColAbs ), // is this the culprit?
X( dt:Time ), // direct column reference
Fit Line(
{Confid Curves Fit( 1 ),
Confid Curves Indiv( 1 ),
Confid Shaded Fit( 1 ),
Confid Shaded Indiv( 1 ),
Line Color( {230, 159, 0} )},
{Set α Level( 0.1 )}
),
Automatic Recalc( 1 ),
SendToReport(
// note reference to one_rb below in use for changing y axis label
Dispatch( {}, one_rb, TextEditBox, {Set Text( "QC parameter value" )} ),
Dispatch( {}, "timepoint 1", TextEditBox, {Set Text( "Time [months]" )} ),
Dispatch( {}, "Linear Fit", OutlineBox, {Close( 1 )} )
),
)
)
)
);
// model selection window with radio buttons & colum list box
nw = New Window( "Model selection",
Show Menu( 0 ),
Show Toolbars( 1 ), // to have access to cross hair
Border Box( Top( 0 ), Bottom( 20 ), Left( 20 ), Right( 10 ),
H List Box(
Panel Box( "Batch",
rb1 = Radio Box(
Eval List( Batch ),
rb1_expr
),
),
Panel Box( "QC parameter (y-axis)",
stabDat = Col List Box(
Max Selected( 1 ),
Width( 250 ),
N Lines( nItems ),
On Change(
yColRel = Column( dt, (stabDat << Get Selected) );
If( Is Empty( startLevel ),
//then
Empty(),
//else
action_expr
)
)
)
),
stabDat << Append( colList );
Panel Box( "Action",
V List Box(
H List Box (
neb = Number Edit Box( Empty(), 7, << Set Function(
startLevel = neb << Get;
If( Is Empty( yColRel ),
//then
Empty(),
//else
action_expr
) ) ),
Spacer Box( Size( 5, 0 ) ),
Text Box( "Enter start level" )
),
Spacer Box( Size( 0, 10 ) ),
Button Box( "Draw graph",
If( ( Is Empty( startLevel ) + Is Empty( yColRel )) > 0,
// then
New Window( "Message", modal,
V List Box(
Text Box( "QC parameter selection and/or start level missing!" ),
Spacer Box( size( 0, 10 ) )
)
),
// else
action_expr
)
),
Spacer Box( Size( 0, 10 ) ),
Button Box ( "Close Window",
If( !Is Empty( PF ), PF << Close Window);
nw << Close Window;
Close(dt, no save)
)
)
),
pb = Panel Box( "Model",
vlb = V List Box () // space for model graph
)
)
)
);
// making the initially selected buttons active in row selection
one_rb = rb1 << Get Selected;
dt << Select Where( (dt:Batch == one_rb) );
dt << Invert Row Selection;
dt << Hide and Exclude;
我认为当您关闭窗口时您的 action_expr 被触发,然后它会变得一团糟。 我不确定为什么会发生这种情况,但 Col List Box 的销毁速度不够快。 作为一种解决方法,您可以将关闭的数据表移动到 On Close() 并将其从“关闭窗口”按钮中删除。
将此添加为最后一行
nw << On close(Close(dt, no save));
并将按钮更改为
Button Box("Close Window",
If(!Is Empty(PF),
PF << Close Window
);
nw << Close Window;
)处理此问题的一种快速而肮脏的方法是更改“关闭窗口”段落以忽略错误
Button Box( "Close Window",
If( !Is Empty( PF ),
Try( PF << Close Window )
);
Try( nw << Close Window );
Try( Close( dt, no save ) );
)
谢谢! 一如既往,非常感谢,但仍然抛出错误消息。@jthi的解决方案虽然有效。
万一这有任何意义,错误消息是由于使用“On Change”而不是“Set Function”与 Column List Box 相关。 该脚本(或至少是此处发布的脚本的修改版本)在不使用“关闭窗口”按钮而是使用窗口右上角的 eXit 按钮退出时不断抛出错误消息。 这发生在我添加了几行以确保无论窗口如何退出都关闭数据表之后。 我怀疑“On Change”被触发了……不知何故……
老的
Panel Box( "QC parameter (y-axis)",
stabDat = Col List Box(
Max Selected( 1 ),
Width( 250 ),
N Lines( nItems ),
On Change( // not working so well for this application
yColRel = Column( dt, (stabDat << Get Selected) );
If( Is Empty( startLevel ),
//then
Empty(),
//else
action_expr
)
)
)
)新的
Panel Box( "QC parameter (y-axis)",
stabDat = Col List Box(
Max Selected( 1 ),
Width( 250 ),
N Lines( nItems ),
<< Set Function( // no more error messages
yColRel = Column( dt, (stabDat << Get Selected) );
If( Is Empty( startLevel ),
//then
Empty(),
//else
action_expr
)
)
)
)
如果有人对生成的应用程序有类似的问题应用程序生成器.
对于应用程序,在关闭()命令可以通过发送
(thisModuleInstance << Get Box) << on close(...)