화면 » Api

mkcontrolarray

Description

버튼을 동적으로 생성하는 API이다.

Parameters

Parameters Type Description
strCtrlName STRING 생성할 기준 오브젝트의 이름
nArrayIndex short 생성할 기준 오브젝트의 Array_Index
nNewArrayIndex short 새로 생성될 오브젝트의 Array_Index

Return Value

Type Description
BOOL 정상 생성 여부(true, false)

Remark

* 버튼에 이미지를 입혀 화면의 메뉴를 구성할 경우에 응용 가능하다. 

* 샘플소스는 일정 간격으로 버튼을 수평, 수직방향으로 추가하는 소스이다.

Example

function btn_mkcontrolarray_on_mouseup() { var instBasisBtn = screen.getarrayinstbyname("btnTest", 0); if(factory.isobject(instBasisBtn) == false) { return; } var nIndex = btnTest.length; if(nIndex <= 0) { return; } var bResult = screen.mkcontrolarray("btnTest", 0, nIndex); if(bResult) { var nGap = 8; // 추가되는 버튼 사이 간격 var nLeft = 0; var nTop = 0; var nRight = 0; var nBottom = 0; if(chkHorz.getcheck()) { nLeft = instBasisBtn.getleft() + (instBasisBtn.getwidth() + nGap) * nIndex; nTop = instBasisBtn.gettop(); nRight = instBasisBtn.getright() + (instBasisBtn.getwidth() + nGap) * nIndex; nBottom = instBasisBtn.getbottom(); } else { nLeft = instBasisBtn.getleft(); nTop = instBasisBtn.gettop() + (instBasisBtn.getheight() + nGap) * nIndex; nRight = instBasisBtn.getright(); nBottom = instBasisBtn.getbottom() + (instBasisBtn.getheight() + nGap) * nIndex; } btnTest[nIndex].setrect(nLeft, nTop, nRight, nBottom); } }

Viewer Ver.

9.1.1.1

Update Date

20110415