사용자 입력의 유효성을 검사하고 필수 입력란을 입력하지 않은 경우 입력 UI를 전달하지 못하게하려고합니다. 지금까지는 버튼 상자가 실제로 스크립트를 순차적으로 실행하지 않는 것처럼 보이거나 전체 스크립트가 완료 될 때까지 변수를 저장하지 않는 것처럼 보입니다. 이 문제를 어떻게 해결할 수 있습니까?
clearLog();
clearGlobals();
clearSymbols();
dt = currentDataTable();
inputGUI = newWindow( "Input Selection UI", << modal,
//Step Name input box
hListBox(
textBox("1. Enter some text input"),
stepTextEdit = textEditBox(),
),
//Column Section input box
hListBox(
vListBox(
choosesrc=filterColSelector( nLines( 6 ) ),
chooseSRC << numeric( 0 ),
),
vListBox(
lineUpBox( nCol( 1 ), spacing( 2 ),
buttonBox( "Add Column >>",
listcols2 << Append( chooseSRC << getSelected );
),
buttonBox( "<< Remove Column",
listcols2 << removeSelected;
),
),
),
vListBox(
listcols2 = colListBox( nLines( 3 ), minItems(1), maxItems(1) ), //col list box with no columns inside
);
),
//Footer Section and OK/Cancel Buttons
hListBox(
buttonBox("OK",
//Collect all variables from input boxes
uinp_stepName = stepTextEdit << getText;
uinp_colssrc=listcols2 << getItems;
// Input Validation Logic
if ( IsMissing(uinp_stepName) == 1,
(nw_error_uinp_stepName = New Window("Error ", << Modal,
VList Box(
Text Box("Text input is missing"),
HList Box(
Button Box ( "OK" ),
),
);
);
break(); // Only send 1 error at a time
)
);
if ( nItems(uinp_colsSRC) == 0,
(nw_error_uinp_colssrc=New Window("Error ", << Modal,
VList Box(
Spacer Box( Size (5, 5) ),
Text Box("Column input is missing"),
Spacer Box( Size (15, 15) ),
HList Box(
Button Box ( "OK" ),
),
);
);
break(); // Only send 1 error at a time
)
);
),
buttonBox("Cancel", Print("User cancelled operation!"); Stop() ),
),
);또한이 목적을 위해 인라인 메시지 "새 메시지에 대한 유효성 확인 (표현식)"을 참조하십시오.
나는 그것이 순서에 어긋나는 것을 평가한다고 생각하지 않는다. 문제는 filterColSelector 객체를 쉼표로 구분 된 행에서 수정하려고한다는 것입니다. 쉼표는 세로 목록 상자 안에 중첩 된 여러 표시 객체를 구분하기위한 것입니다. 이 코드 조각을이 코드 스왑으로 바꾸면 좋을 것입니다.
vListBox(
choosesrc=filterColSelector( nLines( 6 ), << numeric( 0 ))
)
* 또한 vListBox에 다른 항목을 추가 할 계획이 있는지 확실하지 않지만 표시 상자가 1 개만 포함되어 있기 때문에 아마도 제거 할 수 있습니다.