Function pinEvent