Results 1 to 17 of 17
  1.    #1  
    Hi!

    I'm a bit confused about how to be able to quit a scene via Buttons.
    In my scene I implemented an Exit Button. Because it's a fullscreen app I like the idea to close it with a button rather then just swipe it away .

    The code I used is this (found via google):

    Code:
    WellcomeAssistant.prototype.exitButtonPress = function(event){
    	this.exit.bind(this);
    }
    also tried this:

    Code:
    WellcomeAssistant.prototype.exitButtonPress = function(event){
    	Mojo.Controller.stageController.exit.bind(this);
    }
    Does nothing. Does anybody know how to get it work? Thanks in advance.
  2. #2  
    I'm not sure but Have you tried this.exit().bind(this)?
  3.    #3  
    Thanks for the fast reply but no. Doesn't work either.
  4. #4  
    Have you tried just popping that last scene than?
  5.    #5  
    I think I don't understand what you mean. I want that my App closes completly. The Exit Button is placed on the first stage scene.
  6. #6  
    This is how i do close a scene.

    Code:
    	StageController=AppController.getStageController('mainStage');
    	StageController.popScene(); // Closes current scene.
  7. #7  
    just try a .popScene() on the stagecontroller


    It may be difficult by design, if not impossible. WebOS is made to take advantage of the cards and the swiping to close, it's one way the user is uniformly in control. While it would make sense in some cases to close when something is done, an app isn't supposed to "do" anything to the phone and then close, it's supposed to provide some feature while its running.
  8. #8  
    There is no exit function, tha's why nothin's happening.


    Are you trying to exit this scene and go to an underlying one? if so, use:
    Code:
    WellcomeAssistant.prototype.exitButtonPress = function(event){
    	this.controller.stageController.popScene();
    }
    If you trying to close the application completely, you can do:
    Code:
    WellcomeAssistant.prototype.exitButtonPress = function(event){
    	this.controller.window.close();
    }
    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
  9. #9  
    I think what you want is...

    Code:
    	var appController = Mojo.Controller.getAppController();
     	appController.closeStage('mainStage');
  10. #10  
    I'm not sure you want to use "this.controller.window.close();" There is a thought that this method does not allow the Mojo framework to clean up your apps resources. I don't know that for sure though.
  11.    #11  
    Wow nice to see so many responses in 10 Minutes!

    Jason Robitaille your method works.

    Code:
    WellcomeAssistant.prototype.exitButtonPress = function(event){
    	this.controller.window.close();
    }
    Checked with JsTop and it seems that it cleans up everything. But at the moment my new project doesn't need that much resources. So I don't know for sure.

    gobanjoboy yours doesn't work. But I guess that is because it's late in europe and perhpas that's why I'm missing something. Tried this:

    Code:
    var appController = Mojo.Controller.getAppController();
     	appController.closeStage('mainStage');
    also

    Code:
    var appController = Mojo.Controller.getAppController();
     	appController.closeStage('wellcome'); //name of my mainScene
  12. #12  
    Quote Originally Posted by JuJulian1987 View Post
    Wow nice to see so many responses in 10 Minutes!

    Jason Robitaille your method works.

    Code:
    WellcomeAssistant.prototype.exitButtonPress = function(event){
    	this.controller.window.close();
    }
    Checked with JsTop and it seems that it cleans up everything. But at the moment my new project doesn't need that much resources. So I don't know for sure.

    gobanjoboy yours doesn't work. But I guess that is because it's late in europe and perhpas that's why I'm missing something. Tried this:

    Code:
    var appController = Mojo.Controller.getAppController();
     	appController.closeStage('mainStage');
    also

    Code:
    var appController = Mojo.Controller.getAppController();
     	appController.closeStage('wellcome'); //name of my mainScene
    Maybe you are launching your app differently then I?

    Here is how I launch my scene from app-assistant.jsjsjs

    Code:
    	var StageName = "mainStage";
    	var TargetScene = "main";
    	var ViewType = "card"
    	
    	var stageProxy = this.controller.getStageProxy(StageName);
    	var stageController = this.controller.getStageController(StageName);
    	if (stageProxy) {
    		if (stageController) {
    			stageController.window.focus();
    		}
    	} else {
    		var pushConfig = function(stageController) {
    			stageController.pushScene(TargetScene);
    		};
    
    		var configStageArgs = {name: StageName, lightweight: true};
    		this.controller.createStageWithCallback(configStageArgs, pushConfig, ViewType);
    	}
  13. #13  
    Quote Originally Posted by gobanjoboy View Post
    I'm not sure you want to use "this.controller.window.close();" There is a thought that this method does not allow the Mojo framework to clean up your apps resources. I don't know that for sure though.
    To quote Palm on the issue:
    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
  14. #14  
    Quote Originally Posted by Jason Robitaille View Post
    To quote Palm on the issue:


    Seems to indicate
    Code:
    this.controller.window.close()
    is just as safe/clean
    Well thats good to know.
  15. #15  
    Just FYI if your app has a button to pop the scene or exit completely, it will be rejected from the App Catalog. (If you're planning to submit it there)
    Last edited by dallashigh; 02/18/2010 at 09:40 PM.
    Treo 300 > Hitachi G1000 > PPC-6700 > PPC-6800 (Mogul) > PPC-6850 (Touch Pro) > Palm Pre & HTC EVO Optimus V
  16. #16  
    Quote Originally Posted by dallashigh View Post
    Just FYI if your app has a button to pop the scene or exit completely, it will be rejected from the App Catalog. (If you're planning to submit it there)
    What he said! I remember reading this in Palm's checklist before submitting an app...
    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
  17.    #17  
    Okay learned many things out of this topic. Thank you very much. At the moment I stick with the Repo. But later this year (when german apps are allowed to be sold) I'm thinking about giving a full version of preStop and my new project. Will be alot of trouble I guess...

Posting Permissions