Results 1 to 11 of 11
  1.    #1  
    i need to close my app based on, let's say, a button being tapped.

    what would i use in the button's function to close the app? window.close() works, but i'm not sure if it does all the appropriate cleanup. could someone confirm?

    thanks!
    My site: Shanerooni, LLC
    Follow me on Twitter
    My apps: GuessWhat? | MazeHunter3D | Small Wonders | PhakePhoney | AutismAware | PicSketcher | Cubix | QuickSolve | QuickSpell | QuickTrace | QuickWhack | QuickSuite | Soccer Shots | Ballooning |
    Cubix
  2. #2  
    Don't really have a better suggestion for you, but why would you want to have a button action to close your app. To be consistent with the rest of the platform, you should let the user close the app the same way they close other apps; throw it off the screen.
  3.    #3  
    Quote Originally Posted by doczhivago007 View Post
    Don't really have a better suggestion for you, but why would you want to have a button action to close your app. To be consistent with the rest of the platform, you should let the user close the app the same way they close other apps; throw it off the screen.
    true in most cases, but i'm making a round of children's apps and locking the ability to swipe cards to minimize or close. it's all too easy for kids (and even my 8mo old) to get into other apps. so i have been able to lock it down, and that way the only way to close it is to type e-n-d to call window.close(), or m-e-n-u to get back to the menu. phakephoney implemented the menu part, but i want to update that and include the window.close() function for my new app as well. parents seem to love it, and diverting from the normal swipe to close is okay for the parents that have had their kids delete emails, contacts, dial 9-1-1 and so on.
    My site: Shanerooni, LLC
    Follow me on Twitter
    My apps: GuessWhat? | MazeHunter3D | Small Wonders | PhakePhoney | AutismAware | PicSketcher | Cubix | QuickSolve | QuickSpell | QuickTrace | QuickWhack | QuickSuite | Soccer Shots | Ballooning |
    Cubix
  4. djmcgee's Avatar
    Posts
    626 Posts
    Global Posts
    627 Global Posts
    #4  
    I don't have an answer and I'm sure your heart is in the right place. But with all the data and information stored on my phone (personal and business) there is no way I would give it to a child to "play" with. Besides the fact that the Pre is far from robust and is retail a $700 phone. Just my 2 cents.
  5.    #5  
    Quote Originally Posted by djmcgee View Post
    I don't have an answer and I'm sure your heart is in the right place. But with all the data and information stored on my phone (personal and business) there is no way I would give it to a child to "play" with. Besides the fact that the Pre is far from robust and is retail a $700 phone. Just my 2 cents.
    you'd be surprised at how many folks downloaded the app! i let my baby play with it under supervision (cause he likes to try and eat it), but i could see letting a 2-3 year old toy around with it in the car or doctor's office. verizon was advertising to the "moms" for a bit, so maybe there's a pretty big market there to tap into...
    My site: Shanerooni, LLC
    Follow me on Twitter
    My apps: GuessWhat? | MazeHunter3D | Small Wonders | PhakePhoney | AutismAware | PicSketcher | Cubix | QuickSolve | QuickSpell | QuickTrace | QuickWhack | QuickSuite | Soccer Shots | Ballooning |
    Cubix
  6. #6  
    I believe using window.close() is exactly like swiping a card off of the screen (if you don't have any other stages open via an app controller). However, if you want to be 100% sure everything is getting cleaned up try this...

    Create a variable that's used in the cleanup function to figure out if the app should be closed when it's called. Set it up when the scene is instantiated and set it to "false". In the button's listener you'll change the value to "true" and call the cleanup function:
    Code:
    // INSTANTIATE SCENE ASSISTANT
    
        function SceneNameAssistant() {this.closeApp = false;}
    
    // BUTTON HANDLER FUNCTION
    
        SceneNameAssistant.prototype.buttonHandler = function()
        {
            this.closeApp = true;}
            this.cleanup();}
        }
    
    // CLEANUP FUNCTION
    
        SceneNameAssistant.prototype.cleanup = function(event)
        {
            // CLEANUP EVENT HANDLERS AND OTHER CODE
            // CLOSE STAGE WINDOW BASED ON this.closeApp
    
                this.controller.stopListening('button', Mojo.Event.tap, this.buttonHandler.bindAsEventListener(this));
                if (this.closeApp == true) {this.controller.window.close();}
        }
    The only thing I can see going wrong is window.close() calling the cleanup function itself, thereby causing a loop. If that is the case, forget the this.closeApp variable and just use window.close() as you have been since it is obviously calling the cleanup function!

    By the way, I think that is a fantastic idea for children!
    MoBill - Use your Authorize.net account to bill your customers with your webOS device!!
    MoJack - Track your lost or stolen webOS device from anywhere!
    Time to get VIRAL
  7. #7  
    Thanks for the thanks shanerooni! Out of curiosity, which way worked correctly???
    MoBill - Use your Authorize.net account to bill your customers with your webOS device!!
    MoJack - Track your lost or stolen webOS device from anywhere!
    Time to get VIRAL
  8.    #8  
    window.close() works just fine, and doesn't seem to have any performance issues.
    My site: Shanerooni, LLC
    Follow me on Twitter
    My apps: GuessWhat? | MazeHunter3D | Small Wonders | PhakePhoney | AutismAware | PicSketcher | Cubix | QuickSolve | QuickSpell | QuickTrace | QuickWhack | QuickSuite | Soccer Shots | Ballooning |
    Cubix
  9. #9  
    Quote Originally Posted by shanerooni View Post
    window.close() works just fine, and doesn't seem to have any performance issues.
    Correct. I just posted this in another thread.


    To quote Palm:
    Mojo.Controller.appController.closeAllStages() and Mojo.Controller.appController.closeStage() do not work unless you create the respective stages with createStageWithCallback. This bug will be fixed in a future update.
    Workaround—Use window.close(), which has the same effect as closeStage().
    Seems to indicate
    Code:
    this.controller.window.close();
    is just as safe/clean
    If you've liked my software, please consider to towards future development.

    Developer of many apps such as: WebOS Quick Install, WebOS Theme Builder, Ipk Packager, Unified Diff Creator, Internalz Pro, ComicShelf HD, LED Torch, over 70 patches and more.

    @JayCanuck @CanuckCoding Facebook
  10.    #10  
    Quote Originally Posted by Jason Robitaille View Post
    Correct. I just posted this in another thread.


    To quote Palm:


    Seems to indicate
    Code:
    this.controller.window.close();
    is just as safe/clean
    man, you get a thanks just for posting on my thread! haha... THE jason robitaille!
    My site: Shanerooni, LLC
    Follow me on Twitter
    My apps: GuessWhat? | MazeHunter3D | Small Wonders | PhakePhoney | AutismAware | PicSketcher | Cubix | QuickSolve | QuickSpell | QuickTrace | QuickWhack | QuickSuite | Soccer Shots | Ballooning |
    Cubix
  11. #11  
    Quote Originally Posted by Jason Robitaille View Post
    Correct. I just posted this in another thread.


    To quote Palm:


    Seems to indicate
    Code:
    this.controller.window.close();
    is just as safe/clean
    I remember reading that a while back now that you've posted it...thanks!
    MoBill - Use your Authorize.net account to bill your customers with your webOS device!!
    MoJack - Track your lost or stolen webOS device from anywhere!
    Time to get VIRAL

Tags for this Thread

Posting Permissions