Come ottenere che lo script Button Box abbia valutato l'espressioneCIAO,
Sto cercando di creare un'aggiunta automatica di caselle di pulsanti che puntino tramite script a singole caselle di struttura (ad esempio con finestra di scorrimento o di chiusura). Riesco a creare l'espressione tramite un ciclo For che inserisce correttamente il nome degli elementi dello script nell'elenco, ma quando faccio in modo che ciascuna casella di pulsanti abbia uno script univoco, contengono invece il nome dell'espressione 'buttonclickexpr' come script.
Come faccio a far sì che lo script nell'espressione venga valutato e posizionato correttamente come comando scritto, in modo che la casella del pulsante venga eseguita al clic?
//an example of how the window could appear
report_win=new window("test", content_VLB=V List Box(), Outline Box("Example: Distribution"), Outline Box("Example: Multivariate"));
//example of the variable that would store the name of scripts that created the OBs
script_new={"Distribution", "Multivariate", "Profiler"};
//the for loop to correctly setup the expression with the correct section name and add a button
For( i = 1, i <= N Items( script_new ), i++,
buttonclickexpr = Expr(
report_win << Scroll Window(
report_win[Outline Box( sectionName)]
)
);
Substitute Into( buttonclickexpr, Expr(sectionName), Char("Example: " ||script_new[i]) );
write(buttonclickexpr);
// Add a button to the list
content_VLB<
<APPEND></APPEND>
<BR />
<LINGO-LABS id="lingo-labs-914974" slang="en-US" mode="CREATE">
<LINGO-LABEL>Automazione e scripting</LINGO-LABEL>
</LINGO-LABS>
Re: Come ottenere che lo script Button Box abbia valutato l'espressionepuoi usare Eval(Eval Expr()).
//an example of how the window could appear
report_win = New Window( "test",
content_VLB = V List Box(),
Scroll box (Size(20,1500)),
Outline Box( "Example: Distribution" ),
Scroll box (Size(20,1500)),
Outline Box( "Example: Multivariate" )
);
//example of the variable that would store the name of scripts that created the OBs
script_new = {"Distribution", "Multivariate", "Profiler"};
//the for loop to correctly setup the expression with the correct section name and add a button
For( i = 1, i <= N Items( script_new ), i++,
buttonclickexpr = Expr(
report_win << Scroll Window( report_win[sectionName ] );
Caption(sectionName)
);
Substitute Into( buttonclickexpr, Expr( sectionName ), Char( "Example: " || script_new[i] ) );
Write( buttonclickexpr );
// Add a button to the list
Eval (Eval Expr(content_VLB << append( Button Box( "Go to " || script_new[i], Expr(Name Expr(buttonclickexpr)))) ));
);
In OutlineBox("tag") , il tag è l'HelperKey dell'OutlineBox. Per accedere all'Outline Box tramite il titolo, è possibile utilizzare direttamente il titolo [senza OutlineBox() ).
I dettagli possono essere trovati in Re: Gestione delle espressioni in JMP: Tipps e Trapdoor
| utilizzo |
|
| Nome Expr() |
... to retrieve the expression that is stored in the name buttonclickexpr |
| Espr() |
... per contrassegnare il codice, in modo che Valutazione Expr() possa trovarlo |
| Valutazione Expr() |
... per trovare Espr() e valutarlo |
| Valutazione() |
... per valutare l'intera espressione dopo i passaggi precedenti. |
Re: Come ottenere che lo script Button Box abbia valutato l'espressioneUn approccio alternativo: Sostituisci()
[già utilizzato per regolare il buttonclickexpr *)]
Entrambi i passaggi in uno:
For each ({title}, script_new ,
myExpr = Expr(
content_VLB << append( Button Box( "Go to " || title,current report() << Scroll Window( current report()[_sectionName_ ] )));
);
Eval(Substitute (Name Expr(myExpr), Expr( _sectionName_ ), "Example: " || title ));
);
| utilizzo |
|
| Sostituire() |
... come Sostituto per Stringa, ma tieni presente che gli argomenti vengono valutati! Ecco perché devi usare... |
| Nome Expr() |
... per recuperare l'espressione memorizzata nel nome miaEspressione - senza valutarlo!!! |
| Espr() |
... to protect _sectionName_ from getting evaluated |
| Valutazione() |
... per valutare l'intera espressione dopo i passaggi precedenti. |
*) A parte Substitute. Sostituisci in() non valuta il suo primo argomento.