リコールボタンこの質問を元のスレッドに投稿しましたが、適切に強調表示されなかった可能性がありますので、新しい投稿として試してみます。
このリンクのコードは非常に便利そうです
カスタム ウィンドウに [リコール] ボタンを作成する方法 - JMP ユーザー コミュニティ
しかし、リコール機能を適切に活用する方法は私には分かりません。
私が借りて修正したコード (下記) にはリコールがないので、それらを結合する方法を考えていました。 ほぼ完成しましたが、いつものように何かが欠けています。 ご協力いただければ幸いです。
dt = Current Data Table();
cd = Column Dialog(
exy = ColList( "Y", Min Col( 1 ) ),
exx = ColList( "X", Min Col( 1 ) )
);
Eval( cd[1] );
Eval( cd[2] );
yyy = Expr( y() );
xxx = Expr( x() );
xval = exx[1];
For( i = 1, i <= N Items( exy ), i++,
Insert Into( yyy, exy[i] )
);
For( i = 1, i <= N Items( exx ), i++,
Insert Into( xxx, exx[i] )
);
nw = New Window( "Annotated Multiple Plots",
For( i = 1, i <= N Items( exy ), i++,
Notes = exy[i] << Get Property( "Notes" );
Try(
Bivariate(
Y( exy[i] ),
X( exx[1] ),
SendToReport(
Dispatch(
{},
"",
AxisBox( 2 ),
Add Text Annotation(
Text( "Category: " || Notes ),
Fixed Size( 0 ),
Text Box( {-80, 25, 0, 50} ),
Filled( 0 )
)
)
)
)
);
)
);
ありがとう
さよなら
スパナヘッド
自動化とスクリプトRe: リコールボタンさよなら、
以下は、カスタム ウィンドウに [リコール] ボタンを作成する方法で参照されているスクリプトと、スクリプトを単純に組み合わせたものです。まず、提供された例では Column Dialog() を使用し、リコールの例ではユーザー ダイアログに新しいウィンドウを使用しています。JMP では、新しいウィンドウを優先して、列ダイアログが廃止されました。 必要なのは、スクリプトを研究し、それがどのように動作するかを学ぶことです。スクリプトには、理解するのにある程度の時間がかかるいくつかの項目があります。その主要なものの 1 つが NameSpaces です。
Names Default To Here( 1 );
/* Assign dt to reference a table. Open a sample table for demonstration purposes */
dt = Open( "$SAMPLE_DATA/Semiconductor Capability.jmp" );
/* Use a named namespace to hold the recall values */
If( !Namespace Exists( "Custom Dialog" ), // define namespace if it does not exist
dialogRecallNS = New Namespace(
"Custom Dialog",
{
ycolRecall =
{
}
,
orderRecall =
{
}
,
byRecall =
{
}
}
)
, // else get a reference to the existing namespace
dialogRecallNS = Namespace( "Custom Dialog" )
);
nc = N Col( dt );
lbWidth = 130;
// The program to execute when the OK button is pressed
pgm = Expr(
nw = New Window( "Annotated Multiple Plots",
For( i = 1, i <= N Items( exy ), i++,
Notes = Try( exy[i] << Get Property( "Notes" ) );
Try(
Bivariate(
Y( exy[i] ),
X( exx[1] ),
SendToReport(
Dispatch( {}, "", AxisBox( 2 ),
Add Text Annotation(
Text( "Category: " || Notes ),
Fixed Size( 0 ),
Text Box( {-80, 25, 0, 50} ),
Filled( 0 )
)
)
)
)
);
)
)
);
/* Expression to clear all current settings */
clearRoles = Expr(
colListY << RemoveAll;
colListX << RemoveAll;
);
/* Expression to store the current settings in global variables */
recallRoles = Expr(
dialogRecallNS:ycolRecall = colListY << GetItems;
dialogRecallNS:orderRecall = colListX << GetItems;
);
/* Custom Launch Window */
customDlg = New Window( "Example of a Custom Dialog",
Border Box( Left( 3 ), top( 2 ),
V List Box(
Text Box( "Example dialog to demonstrate a Recall button" ),
H List Box(
V List Box(
Panel Box( "Select Columns",
colListData = Col List Box( All, width( lbWidth ), nLines( Min( nc, 10 ) ) )
)
),
Panel Box( "Cast Selected Columns into Roles",
Lineup Box( N Col( 2 ), Spacing( 3 ),
Button Box( "Y", colListY << Append( colListData << GetSelected ) ),
colListY = Col List Box( width( lbWidth ), nmin( 1 ), nLines( 5 ), numeric ),
Button Box( "X", colListX << Append( colListData << GetSelected ) ),
colListX = Col List Box( width( lbWidth ), nLines( 1 ), numeric )
)
),
Panel Box( "Action",
Lineup Box( N Col( 1 ),
Button Box( "OK",
recallRoles;
exy = colListY << get items;
exx = colListX << get items;
pgm;
customDlg << CloseWindow;
),
Button Box( "Cancel", customDlg << CloseWindow ),
Button Box( "Reset", clearRoles ),
Text Box( " " ),
Button Box( "Remove",
colListY << RemoveSelected;
colListX << RemoveSelected;
),
Button Box( "Recall",
clearRoles;
/* Restore any previous settings from the namespace variables */
Try(
colListY << Append( dialogRecallNS:ycolRecall );
colListX << Append( dialogRecallNS:orderRecall );
);
)
)
)
)
)
)
);
colListx << set min items( 1 );
colListy << set min items( 1 );
提供された JSL 内の、この例では何も行われないと思われるコード行をいくつか削除したことに注意してください。
Re: リコールボタンJim が提供したスクリプトからインスピレーションを得て、それにRecall 関数ライブラリを適用することができます。これは、JSL のさまざまなことを学ぶ (既存の実用的なソリューションを変更して、別のパッケージを使用する) ための非常に優れた方法である可能性があります。私は個人的には、Recall ライブラリの動作方法が気に入らないので使用していません (独自のものを作成中です) が、私の知る限り、これは現在、すべてを自分で記述せずに Recall を実装する最良の方法です。
Re: リコールボタンこれは非常に近いもので、説明どおりに動作しますが、全体的な目的は、メモの情報に基づいてグラフに注釈を強制する方法を確保することであり、どういうわけか、このリビジョンではそれが機能しません。
注釈が失われ、メモ自体には何も含まれません。
Notes = Try(exy[i] << Get Property( "Notes" ));
Show(Notes);
なぜそうなるのか、何か手がかりはありますか?
ありがとう
さよなら
スパナヘッド
Re: リコールボタン変更してみてください
Notes = Try(exy[i] << Get Property("Notes"));
に
Notes = Try(Column(dt, exy[i]) << Get Property("Notes"));
<< Colリストボックスの項目を取得すると文字列のリストが返されます
Re: リコールボタンそれらの作品を組み合わせるのはまさにその通りです。
ありがとう
さよなら
スパナヘッド