//####
//# Legal Notice :
//#    Copyright, Harman International, 2015
//#    Private, proprietary information, the sole property of Harman.  The
//#    contents, ideas, and concepts expressed herein are not to be disclosed
//#    except within the confines of a confidential relationship and only
//#    then on a need to know basis.
//#
//#    Any entity in possession of this Harman Software shall not, and shall not
//#    permit any other person to, disclose, display, loan, publish, transfer
//#    (whether by sale, assignment, exchange, gift, operation of law or
//#    otherwise), license, sublicense, copy, or otherwise disseminate this
//#    Harman Software.
//#
//#    This Harman Software is owned by Harman and is protected by United States
//#    copyright laws, patent laws, international treaty provisions, and/or
//#    state of Texas trade secret laws.
//#
//#    Portions of this Harman Software may, from time to time, include
//#    pre-release code and such code may not be at the level of performance,
//#    compatibility and functionality of the final code. The pre-release code
//#    may not operate correctly and may be substantially modified prior to
//#    final release or certain features may not be generally released. Harman is
//#    not obligated to make or support any pre-release code. All pre-release
//#    code is provided "as is" with no warranties.
//#
//#    This Harman Software is provided with restricted rights. Use, duplication,
//#    or disclosure by the Government is subject to restrictions as set forth
//#    in subparagraph (1)(ii) of The Rights in Technical Data and Computer
//#    Software clause at DFARS 252.227-7013 or subparagraphs (1) and (2) of
//#    the Commercial Computer Software Restricted Rights at 48 CFR 52.227-19,
//#    as applicable.
//####

PROGRAM_NAME='ISE_CUSTOM_EVENT'
(***********************************************************)
(***********************************************************)
(*  FILE_LAST_MODIFIED_ON: 04/05/2006  AT: 09:00:25        *)
(***********************************************************)
(* System Type : NetLinx                                   *)
(***********************************************************)
(* REV HISTORY:                                            *)
(***********************************************************)
(*
    $History: $
*)
DEFINE_DEVICE
dvTP = 10001:1:0

 
DEFINE_CONSTANT
// CONTACTS Listview button address
INTEGER btnListview = 11

DEFINE_VARIABLE

DEFINE_EVENT
 
 
 // The custom event that is raised whenever a contact on 
 // the listview item is selected on the panel
CUSTOM_EVENT[dvTP,btnListview,LISTVIEW_ON_ROW_SELECT_EVENT]
{
    SLONG payloadId
    SLONG payloadType
    CHAR fields[3][16]
    CHAR name[DATA_MAX_VALUE_LENGTH]
    CHAR number[DATA_MAX_VALUE_LENGTH]
    CHAR image[DATA_MAX_VALUE_LENGTH]
    DATA_RECORD record

    // Get the data access ID from the custom event
    payloadId = custom.value1
    // Get the data type from the custom event
    payloadType = custom.value2
     
    if (payloadId > 0 && payloadType == DATA_STRUCTURE_DATARECORD)
    {
    // Specify which fields we want to retrieve from the payload
    fields[1] = 'column1'
    fields[2] = 'column3'
    fields[3] = 'column2'
	// Populate a record with the requested fields from the event
	if (DATA_GET_EVENT_RECORD(dvTP, payloadId, fields, record) > 0)
	{
	    // All is well so far so copy the values that we are
	    // interested in from the selection that the user made on
	    // the panel.
	    name = record.content[1].value
	    number = record.content[2].value
	    image = record.content[3].value
	    
	    // Put the name and number that was selected on a popup and
	    // show the popup
	    SEND_COMMAND dvTP,"'^TXT-50,0,',name"
	    SEND_COMMAND dvTP,"'^TXT-51,0,',number"
	    SEND_COMMAND dvTP,"'^BMX-52,0,',image,',1,10'"
	    SEND_COMMAND dvTP,"'^PPN-Calling'"
	    SEND_COMMAND dvTP, "'^PPT-Calling;50'"
	}
    }
}

DEFINE_PROGRAM

(***********************************************************)
(*                     END OF PROGRAM                      *)
(*        DO NOT PUT ANY CODE BELOW THIS COMMENT           *)
(***********************************************************)

