안녕하세요,
함수 내에서 버튼 박스를 생성할 때 지역 변수에 접근하는 방법을 찾고 있습니다. 여기 게시글 중 하나에서 윈도우 네임스페이스에 변수를 할당하는 방법을 제시한 것을 본 적이 있는데, 제가 만들고자 하는 보고서는 같은 창 안에 여러 요소가 재사용되기 때문에 이 방법은 적합하지 않을 것 같습니다.
제 예시에서는 단순히 연결 리스트의 값을 출력하려고 했지만, 최종 스크립트에서는 훨씬 더 많은 작업을 수행할 것입니다 (테스트/임시방편으로 전역 변수를 사용하여 모든 기능이 작동하도록).
// General Component - List Box
make_a_list_box = Function( {list_in},
{Default Local},
l_box = List Box( list_in );
Return( l_box );
);
// General Component - Button linked to a specific list box
linked_button_box = Function( {button_name, target_list_box},
{Default Local},
b_box = Button Box( button_name, Print( target_list_box << Get Items ) ); // Name Unresolved: target_list_box
Return( b_box );
);
// Basic Module - Expect multiple in a shared window
report_module = Function( {list_in, button_name},
{Default Local},
report_list = make_a_list_box( list_in );
report_button = linked_button_box( button_name, report_list );
report = H List Box( report_list, report_button );
Print( report_list << Get Items );
Return( report );
);
// Example Window using multiple modules
New Window( "Test",
V List Box(
report_module( {"A", "B", "C"}, "Letter" ),
report_module( {"1", "2", "3"}, "Number" )
)
);