enuSpace professional 2016 기준
enuSpace HMI 편집기를 이용한 동적 디스플레이 기능
Dynamic Script
속성 변경
속성의 변수 타입이 boolean인 속성은 스크립트 내에서는 true, false 값을 할당함으로써 바꿀 수 있으며, wchar 인 속성은 string의 보조 함수인 string.format 함수를 이용해서 바꿀 수 있다. wchar 속성의 변수를 string.format 함수를 사용하지 않고 직접 할당할 경우 처음에 할당되었던 문자의 크기보다 새로이 할당된 문자의 크기가 클 경우 메모리 침범이 발생할 수 있으며, 심해질 경우 프로그램이 정지할 수도 있다. 속성 변수의 이름은 -가 포함될 수 없으며 '-'는 '_'로 대치(속성 : fill-opacity, 변수명 : fill_opacity)하여 변수를 설정하였으므로 반드시 '-'는 '_'로 바꾸어 사용해야 한다.
boolean : visibility, lock, disabled, multiline, password, read-only, want-return, border, number, lowercase, uppercase, static-edge, auto-scroll, horizontal-scroll, vertical-scroll 등.
wchar : id, fill, stroke-dash, stroke, points, d, text, font-family 등.
int : stroke-width, stroke-linejoin, stroke-linecap, text-anchor, font-style, font-weight 등.
float, double : fill-opacity, stroke-opacity, x, y, rx, ry, width, height, translate-x, translate-y, rotate, scale-x, scale-y, center-x, center-y, cx, cy, r, rx, ry, font-size 등.
색상변경 : 문자열 속성
각 객체의 색상은 텍스트 문자열로 "rgb(0,0,0)" , "black" 또는 "#000000" 처럼 스크립트 내에서 입력함으로써 변경할 수 있다.

onmousedown 이벤트에 의해 index의 값을 바꾸고 index 값에 따라 색상 값을 반환해주는 GetColor함수에서 색상 값을 받아서 사각영역을 채우는 색상 fill값을 바꾼다.

투명도 변경 : float 속성
각 객체의 색상은 0~1 사이의 투명도를 가지며 실수이다. 0은 완전 투명 1은 완전 불투명이다.

onmousedown 이벤트에 의해 index의 값을 바꾸고 index 값에 따라 투명도 값을 반환해주는 GetOpacity함수에서 투명도 값을 받아서 사각영역의 투명도를 설정하는 fill-opacity 값을 바꾼다.

visibility 변경 : boolean 속성
각 객체의 속성 중 visibility는 객체가 보여질 것인지 보여지지 않을 것인지에 대해 결정하며 조건에 따라 객체가 보여질지 안 보여질지에 대해 스크립트 내에서 설정할 수 있는데 visibility의 변수 타입은 boolean이므로 스크립트 내에서 true 혹은 false로 할당하여 바꿀 수 있다.
다음 그림 예시는 세 개의 문자열 "빨강", "녹색", "파랑"의 visibility속성을 사각형의 마우스 다운이벤트가 한번 발생할 때마다 바뀌는 예시이며, 각각의 문자열은 사각형에 이웃한 객체의 고유한 id를 가지고 id.visibility를 바꾸는 스크립트를 작성한 예제이다.

다음 그림은 visibility를 바꾸는 이벤트 함수가 차례로 실행되어 표시된 상태이고 ○1은 편집 창에서의 표시를 나타내고 ○2는 실행창에서의 표시를 나타낸다. 편집 창에서는 편집을 위해 객체가 완전히 사라지지 않고 hidden 상태를 나타내는 회색 박스를 표시한다.
