iOS Question InputDialog function?

Discussion in 'iOS Questions' started by techknight, Apr 12, 2015.

  1. techknight

    techknight Well-Known Member Licensed User

    Is there an InputDialog function for B4I? I forget what library it was in for B4A.
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    No. You can use a panel to implement a similar (non-modal) dialog.

    Edit: See post #5 for a solution...
     
    Last edited: Apr 14, 2015
  3. techknight

    techknight Well-Known Member Licensed User

  4. Filippo

    Filippo Expert Licensed User

    How can you use the class UIAlertView as Inputdialog?

    or these examples as "Inline Objective C code" ?
     
  5. Erel

    Erel Administrator Staff Member Licensed User

    Here:
    Code:
    Private Sub Application_Start (Nav As NavigationController)
       NavControl = Nav
       Page1.Initialize(
    "Page1")
       Page1.Title = 
    "Page 1"
       Page1.RootPanel.Color = 
    Colors.White
       NavControl.ShowPage(Page1)
    End Sub

    Sub Page1_Click
       
    Dim no As NativeObject = Me
       no.RunMethod(
    "ShowInputDialog::"Array("This is the title""Message"))
    End Sub

    Sub InputDialog_Result(Text As String)
       
    Log("Result: " & Text)
    End Sub

    #If OBJC
    - (void)ShowInputDialog:(NSString*)Title :(NSString*)Message
    {
      UIAlertView * alert = [[UIAlertView alloc] initWithTitle:Title
         message:Message delegate:self cancelButtonTitle:@"Hide" otherButtonTitles:nil];
       alert.alertViewStyle = UIAlertViewStylePlainTextInput;
      alert.delegate = self;
      [alert show];
    }
    - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
    {
       [self.bi raiseEvent:nil event:@"inputdialog_result:" params:@[[[alertView textFieldAtIndex:0] text]]];
    }
    #End If
     
    ilan, MarcoRome, luke2012 and 3 others like this.
  6. techknight

    techknight Well-Known Member Licensed User

    Perfect. But....

    I have a few different subroutines that grab input and have different prompts, Now how to handle those in the InputDialog event? It seems there's only 1 event, so need some kind of sender or primary key to let the event know "which" subroutine I am dealing with.

    I guess i could have multiple Voids, one for each subroutine.
     
  7. techknight

    techknight Well-Known Member Licensed User

    nevermind. I just threw an integer variable in the globals and used that to track what its doing.
     
  8. Filippo

    Filippo Expert Licensed User

    Thank you Erel! :)
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice