목록 보기 제어 도구 내에서 강조표시된 레코드의 데이터베이스 ID를 리턴합니다.
이 특성을 단추 누르기 이벤트(즉, AD_BUTTON_CLICK 이벤트 유형)에 대한 응답으로 사용하여 상위/하위 목록 상자에서 선택된 값을 찾을 수 있습니다. 메소드는 참조되는 레코드 유형의 1차 키를 리턴합니다.
목록 선택사항을 가져오려면, 항목을 선택할 수 있기 원하는 목록 제어 도구(예: 상위 하위 제어 도구)에 단추를 연관시키십시오. 또한 목록 보기 유형 기타도 선택해야 합니다. 이 경우 단추를 눌렀을 때 리턴되는 값은 참조되는 레코드의 키입니다(다중 파트 키의 일부는 공백으로 구분됨).
VBScript
' The following script is invoked when a user presses a button named "Select" ' that is associated with a ListView control and performs an action of type ' "Other" (on the extended properties tab)): Function Defect_Cust_Sel(param) ' param As Variant Dim ListSel, Sel On Error Resume Next ListSel = param.ListSelection Sel = ListSel(0) SetFieldValue "Customer", Sel End Function ' The following example checks for event type, session type, and whether or ' not something is selected: Function MyRecordHook(param) ' param As Variant ' record type name isMyRecord Dim ListSel Dim Item ' Check if it is an event which you can have a selection for if param.eventtype = AD_BUTTON_CLICK then ' Make sure you aren't on the web since ListSelection doesn't work there if not GetSession.HasValue("_CQ_WEB_SESSION") then ' OK we're not on the web. Now check to see if anything is selected ListSel = param.ListSelection if ubound(ListSel) < lbound(ListSel) then ' Nothing is selected else Item = ListSel(0) ' ListSel is an array of strings with one element when ' something is selected ' and no elements when nothing is selected ' Put your code here to do what you need to do msgbox "Selected item was:" & Item end if else ' Web interface, ListSelection API call doesn't work here end if else ' Its not a button click event, listselection only works with ' button click events end if End Function