Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

optionDialog will not hide problem

In a navigation group I have a window that shows an optionDialog on the rightNavButton. When navigation to the previous window in the navigationGroup with the optionDialog opened, the optionDialog will not hide itself neither is there a method to hide it programmically. I tried nullifying the optionDialog and the rightNavButton but this did not solve the issue.

Previously I used a Popover with a tableview but this has appearant disadvantages. So if someone can help me solve the issue with the optionDialog it is highly appreciated.

— asked November 23rd 2010 by edgar vos
  • ipad
  • optiondialog
1 Comment
  • Touching the screen on any part of the window will hide the optionDialog so I tried to fire a click event programmatically on the window but also without success…..

    — commented November 23rd 2010 by edgar vos

3 Answers

  • Hello, I had the same problem

    But in my case was when the app was put on pause and return, my code was causing the app back on a screen asking to login again, and the optionDialog still visible.

    To fix I added the function Hide.

    Open /Library/Application Support/Titanium/mobilesdk/osx/1.X.X/iphone/Classes/TiUIOptionDialogProxy.m

    and before this line:

    
    -(void)show:(id)args
    

    add this code:

    
    -(void)hide:(id)args
    {
        [actionSheet dismissWithClickedButtonIndex:-2 animated:animated];
        [self fireEvent:@"hide" withObject:nil];
        [[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationWillChangeStatusBarOrientationNotification object:nil];
        RELEASE_TO_NIL(actionSheet);
    
    }
    

    Save and do a full compile of your project.

    Now you can use in your JS:

    
    myOptionDialog.hide();
    
    — answered December 28th 2010 by Adriano Paladini
    permalink
    2 Comments
    • Do you know how to do this for android? Thanks!

      — commented January 27th 2011 by Luciano Longo
    • I have tried various things and would love to have this option. Any know where to edit this for android?

      — commented April 2nd 2011 by Pete Halatsis
  • Dumb question, but have you tried calling youroptiondialog.hide() just to see if that method is there but undocumented? Maybe blur()?

    — answered November 23rd 2010 by Tim Poulsen
    permalink
    0 Comments
  • Hi Tim,

    Thanks for your reply.. Yes, I did notice that the documentation on the .show states that it does not take any parameters while actually it does. So I did try .hide(), and tried .blur() as you suggested, but neither exist.

    Regards
    Edgar

    — answered November 23rd 2010 by edgar vos
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.