#Event: Result(Success As Boolean, Text As String)
'Class module
Sub Class_Globals
Private CallBack As Object
Private mEventName As String
Private items As List
End Sub
'Initializes the object. You can add parameters to this method if needed.
Public Sub Initialize(Module As Object, EventName As String, Voices As List)
CallBack = Module
mEventName = EventName
items=Voices
End Sub
Public Sub Show(Pane As Panel,Title As String, Cancel As Boolean)
Dim no As NativeObject = Me
no.RunMethod("ShowInputList:::::", Array(Pane,"event_event", Title,items,Cancel))
End Sub
Private Sub InputList_Result(Index As Int)
If SubExists(CallBack, mEventName & "_Result", 1) Then CallSub2(CallBack, mEventName & "_Result", Index)
End Sub
#If OBJC
- (void)ShowInputList:(UIView *)view:(NSString*)Event :(NSString*)Title :(NSArray*)array: (bool)canc
{
// NSArray *array = @[@"1st Button",@"2nd Button",@"3rd Button",@"4th Button"];
UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:Title
delegate:self
cancelButtonTitle:nil
destructiveButtonTitle:nil
otherButtonTitles:nil];
// ObjC Fast Enumeration
for (NSString *title in array) {
[actionSheet addButtonWithTitle:title];
}
if (canc) { actionSheet.cancelButtonIndex = [actionSheet addButtonWithTitle:@"Cancel"];}
[actionSheet showInView:view];
}
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {
NSLog(@"%i", buttonIndex);
[self.bi raiseEvent:nil event:@"inputlist_result:" params:@[@(buttonIndex)]];
}
#End If