From 1098e5dcd5679535e1b480bdbebb730cffa078d5 Mon Sep 17 00:00:00 2001 From: adnathan Date: Thu, 10 Mar 2016 15:33:14 -0800 Subject: [PATCH] iOS SelectionChanged event: pass item + index --- src/ios/ListBox.mm | 2 +- src/ios/OutgoingMessages.h | 1 + src/ios/OutgoingMessages.mm | 10 ++++++++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/ios/ListBox.mm b/src/ios/ListBox.mm index e594fc1..71bcc1a 100644 --- a/src/ios/ListBox.mm +++ b/src/ios/ListBox.mm @@ -165,7 +165,7 @@ NSObject* selection = _Items[indexPath.row]; if (_selectionChangedHandlers > 0) { - [OutgoingMessages raiseEvent:@"selectionchanged" instance:self eventData:selection]; + [OutgoingMessages raiseEvent:@"selectionchanged" instance:self eventData:selection eventData2:[NSNumber numberWithInt:indexPath.row]]; } } diff --git a/src/ios/OutgoingMessages.h b/src/ios/OutgoingMessages.h index 9e136e5..7b7cf92 100644 --- a/src/ios/OutgoingMessages.h +++ b/src/ios/OutgoingMessages.h @@ -9,6 +9,7 @@ + (void) setCallbackContext:(NSObject*)callback selector:(SEL)selector; + (void) raiseEvent:(NSString*)eventName instance:(NSObject*)instance eventData:(NSObject*) eventData; ++ (void) raiseEvent:(NSString*)eventName instance:(NSObject*)instance eventData:(NSObject*) eventData eventData2:(NSObject*) eventData2; + (void) raiseEvent:(NSString*)eventName handle:(AceHandle*)handle eventData:(NSObject*) eventData; @end diff --git a/src/ios/OutgoingMessages.mm b/src/ios/OutgoingMessages.mm index 391fa68..937ec5e 100644 --- a/src/ios/OutgoingMessages.mm +++ b/src/ios/OutgoingMessages.mm @@ -19,8 +19,14 @@ SEL _selector; + (void) raiseEvent:(NSString*)eventName instance:(NSObject*)instance eventData:(NSObject*) eventData { NSArray* array = [NSArray arrayWithObjects: instance == nil ? nil : [[AceHandle fromObject:instance] toJSON], - eventName, - eventData, nil]; + eventName, eventData, nil]; + [self send:array]; +} + ++ (void) raiseEvent:(NSString*)eventName instance:(NSObject*)instance eventData:(NSObject*) eventData eventData2:(NSObject*) eventData2 { + NSArray* array = [NSArray arrayWithObjects: + instance == nil ? nil : [[AceHandle fromObject:instance] toJSON], + eventName, eventData, eventData2, nil]; [self send:array]; }