:: 버튼 내 텍스트 줄바꿈 시, ctrl + Enter
이벤트 함수 생성
1. 더블클릭
2. 클릭 > 우측 Properties > 네번째 아이콘 > onclick부분 값 입력후 enter
함수 입력
this.Button00_onclick = function(obj:nexacro.Button,e:nexacro.ClickEventInfo){
this.alert("hello");
};
2. log 찍기
this.Button00_onclick = function(obj:nexacro.Button,e:nexacro.ClickEventInfo){
this.alert("hello");
nexacro.getApplication().trace("로그1");
};
this.Button00_onclick = function(obj:nexacro.Button,e:nexacro.ClickEventInfo){
this.alert("hello");
var objApp = nexacro.getApplication();
objApp.trace("로그2");
};
.set_속성명() : 속성의 값 세팅하는 메서드this.Button00_onclick = function(obj:nexacro.Button,e:nexacro.ClickEventInfo){
this.alert("hello");
nexacro.getApplication().trace("로그1");
//세팅 : set_속성명
this.Button00.set_text("그냥 안녕");
//확인
this.alert(this.Button00.text);
};
가운데 상단 돋보기 모양 (QuickView) 클릭 > 브라우저 선택
기존 코드
this.Button00_onclick = function(obj:nexacro.Button,e:nexacro.ClickEventInfo){
this.alert("hello");
nexacro.getApplication().trace("로그1");
//세팅 : set_속성명
this.Button00.set_text("그냥 안녕");
//확인
this.alert(this.Button00.text);
};
하지만,
명명 규칙에 의해 버튼의 id명을 Button00 => btnHello로 바꿨다고 하자.
그렇다면 위의 코드는 다음과 같이 바꿔야 정상 작동 하게 된다.
this.Button00_onclick = function(obj:nexacro.Button,e:nexacro.ClickEventInfo){
this.alert("hello");
nexacro.getApplication().trace("로그1");
//세팅 : set_속성명
this.btnHello.set_text("그냥 안녕"); //수정
//확인
this.alert(this.btnHello.text); //수정
};
어느 세월에 id명을 하나하나 바꿀텐가?!
그래서,
한 번에 바꾸는 방법이 있다.
위의 함수 젤 첫 라인을 보면,
function에 obj 와 e 라는 파라미터 2개가 전달되는 것을 볼 수 있다.
여기서
obj는 this.Button을 의미한다.
this.Button00_onclick = function(obj:nexacro.Button,e:nexacro.ClickEventInfo)
그래서
this.Button대신에obj를 사용하면,
id가 변경되어도 별 다른 수정 없이 적용가능하다.
this.Button00_onclick = function(obj:nexacro.Button,e:nexacro.ClickEventInfo){
this.alert("hello");
nexacro.getApplication().trace("로그1");
//세팅 : set_속성명
obj.set_text("그냥 안녕"); //수정
//확인
this.alert(obj.text); //수정
};
즉, Event에서 Script 작성 시, 파라미터 사용하기