Results 1 to 19 of 19
  1.    #1  
    For some reason none of this works! They all fail:

    //Fails with "Object #<an anonymous> has no method 'getStageController'"
    this.controller.getStageController( "HelloWorld" ).pushScene( "NewScene" );

    //Fails with "Object #<an anonymous> has no method 'pushScene'"
    this.controller.pushScene( "NewScene" );

    I can't seem to push a new scene from within my button press (and yes, I did bind it to "this")! What do I need to do?
  2. cube660's Avatar
    Posts
    57 Posts
    Global Posts
    58 Global Posts
    #2  
    It's:
    Mojo.Controller.stageController.pushScene();
  3. rothoof's Avatar
    Posts
    510 Posts
    Global Posts
    514 Global Posts
    #3  
    Quote Originally Posted by cube660 View Post
    It's:
    Mojo.Controller.stageController.pushScene();
    ok total newb here, so if the name of the scene is pogp would it go :

    Mojo.Controller.stageController.pushScene(pogp);
  4. rothoof's Avatar
    Posts
    510 Posts
    Global Posts
    514 Global Posts
    #4  
    I thought i would ask a couple more questions instead of starting a new thread.

    FYI i'm using ares.

    How do you make names appear on a list, I assume you replace one of these below with your item name? Does it only show up when the app is running?

    [{"item":0,"label":"Zero","value":0},
    {"item":1,"label":"One","value":1},
    {"item":2,"label":"Two","value":2},
    {"item":3,"label":"Three","value":3}]

    how do you make text appear they way you want it to, for example, i put all the text in but it just squeezes it all together, it doesnt save any paragraph changes or anything like that. i am using the html widget for a book app, is that the correct way
    Thanks in advance
  5. spdqbr's Avatar
    Posts
    78 Posts
    Global Posts
    80 Global Posts
    #5  
    Quote Originally Posted by rothoof View Post
    ok total newb here, so if the name of the scene is pogp would it go :

    Mojo.Controller.stageController.pushScene(pogp);
    Close, go with
    Code:
    Mojo.Controller.stageController.pushScene("pogp");
  6. #6  
    dude. under the pallet. click the button. go to events. hit the little paper under tap or whatever. under the putton put this.controller.stagecontroller.pushScene('a;lskdjfl;sakdfj') the random stuff is your scene. but you must have created the new scene first. and thats it.
  7. rothoof's Avatar
    Posts
    510 Posts
    Global Posts
    514 Global Posts
    #7  
    Quote Originally Posted by acez3001 View Post
    dude. under the pallet. click the button. go to events. hit the little paper under tap or whatever. under the putton put this.controller.stagecontroller.pushScene('a;lskdjfl;sakdfj') the random stuff is your scene. but you must have created the new scene first. and thats it.
    ok got the button to work and i got the html to show up how i wanted it to, still cant figure out the list. with the app im making i could actually just use buttons but that would be lame. I cant figure out how to make items show up in a list, any help would be great

    Would i have to reference a file above this code to make it work?
    [{"item":0,"label":"Zero","value":0},
    {"item":1,"label":"One","value":1},
    {"item":2,"label":"Two","value":2},
    {"item":3,"label":"Three","value":3}]
    Last edited by rothoof; 01/07/2010 at 10:02 PM. Reason: added details,
  8. #8  
    Quote Originally Posted by rothoof View Post
    ok got the button to work and i got the html to show up how i wanted it to, still cant figure out the list. with the app im making i could actually just use buttons but that would be lame. I cant figure out how to make items show up in a list, any help would be great

    Would i have to reference a file above this code to make it work?
    [{"item":0,"label":"Zero","value":0},
    {"item":1,"label":"One","value":1},
    {"item":2,"label":"Two","value":2},
    {"item":3,"label":"Three","value":3}]
    Ive been having trouble with making a list show up as well. There is a list widget tutorial over in this thread h t t p://forums.precentral.net/web-os-development/208819-great-list-widget-tutorial.html , but it doesn't show how to do it in Ares. I got a better idea for it, but it is still not working.
    Good Luck!
  9. #9  
    did you find out how it should be to push a scene from a list?
  10. #10  
    It all boils down to whether you have an app assistant or not. If you are working inside of a scene assistant and you DO have an app assistant, then use...

    Code:
    this.controller.stageController.swapScene("NewScene");
    (You forgot to add the "stageController" part in your example above.)

    You don't have to specify which stage here because you are already in a scene that is attached to a specific stage. The following will NOT work if you have an app assistant...

    Code:
    Mojo.Controller.stageController.pushScene("NewScene");
    If you are working INSIDE of an app assistant you were on the right track with...

    Code:
    this.controller.getStageController( "HelloWorld" ).pushScene( "NewScene" );
    That is the only way to tell the app controller which stage/scene combination to push. It may seem weird at first, but when you start creating apps with multiple stages (which requires an app assistant) you'll see why it's like this!
    Last edited by Laxidasical; 03/02/2010 at 06:59 PM. Reason: Typo
    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
  11. #11  
    Your list must be setup in the scene'e view file and a list widget setup in the setup() function of the scene assistant. You will also need an item template (located within the scene's view file folder).

    View file...

    Code:
    <div id="list" x-mojo-element="List"></div>
    Item template... (itemTemplate.html in view folder)

    Code:
    <div class="palm-row" x-mojo-tap-highlight="momentary">
      <div class="palm-row-wrapper textfield-group">
        <div class="text">#{label}</div>
      </div>
    </div>
    Setup function of scene assistant...

    Code:
    YourAssistant.prototype.setup = function()
    {
        var listAttributes =
        {
             itemTemplate: 'myScene/itemTemplate', // <- REPLACE "myScene" WITH YOUR SCENE NAME
            swipeToDelete: false,
              reorderable: false
        };
    
        this.listModel =
        {
            items:
            [
                {"item":0,"label":"Zero","value":0},
                {"item":1,"label":"One","value":1},
                {"item":2,"label":"Two","value":2},
                {"item":3,"label":"Three","value":3}
            ]
        };
    
        this.controller.setupWidget('list', listAttributes, this.listModel);
        this.controller.listen('list', Mojo.Event.listTap, this.listHandler.bindAsEventListener(this));
    }
    Be sure to change the id accordingly in your view file and widget setup! I also added a listener here if you want users to interact (tap) items on your list. If you use it you'll need to create a function in your assitant called "listHandler" (or whatever you choose to rename it). It will be able to access the item tapped as such:

    Code:
    YourAssistant.prototype.listHandler = function(item)
    {
        // FIND OUT WHICH WAS SELECTED
        // GET THE VALUE OF IT
    
            var selected = this.setupListModel.items[item.index];
            var value    = selected.value;
    };
    Finally, don't forget to cleanup your listener!!!

    Code:
    YourAssistant.prototype.cleanup = function()
    {
        this.controller.stopListening('list', Mojo.Event.listTap, this.listHandler.bindAsEventListener(this));
    };
    Last edited by Laxidasical; 03/02/2010 at 07:27 PM.
    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
  12. rothoof's Avatar
    Posts
    510 Posts
    Global Posts
    514 Global Posts
    #12  
    Im trying to figure out what kinda button this is in the lower left hand corner of the tasks app, I want to add one to my app but cant find it. anybody know?
    Attached Images Attached Images
  13. #13  
    Quote Originally Posted by rothoof View Post
    Im trying to figure out what kinda button this is in the lower left hand corner of the tasks app, I want to add one to my app but cant find it. anybody know?
    It's a commandButton. Search for it on webosdev

    -- Sent from my Palm Pre using Forums Beta
    Newness Developments apps:

  14. #14  
    Quote Originally Posted by rothoof View Post
    ok got the button to work and i got the html to show up how i wanted it to, still cant figure out the list. with the app im making i could actually just use buttons but that would be lame. I cant figure out how to make items show up in a list, any help would be great

    Would i have to reference a file above this code to make it work?
    [{"item":0,"label":"Zero","value":0},
    {"item":1,"label":"One","value":1},
    {"item":2,"label":"Two","value":2},
    {"item":3,"label":"Three","value":3}]
    You can check out my Ares tutorial which uses lists here:
    Creating your own medical apps for WebOS (part 5)
    Check out my My Medical webOS Apps
    Featured free apps: DrugView | Eponyms | eMed | Dosecalcfree | Beeb News
  15. rothoof's Avatar
    Posts
    510 Posts
    Global Posts
    514 Global Posts
    #15  
    hmm i dont see it on developer.palm.com
  16. rothoof's Avatar
    Posts
    510 Posts
    Global Posts
    514 Global Posts
    #16  
    Is there a widget for the command buttons? and where do i find it?
  17. acidhax's Avatar
    Posts
    150 Posts
    Global Posts
    156 Global Posts
    #17  
    Quote Originally Posted by rothoof View Post
    Is there a widget for the command buttons? and where do i find it?
    The widget is "Mojo.Menu.commandMenu"
  18. rothoof's Avatar
    Posts
    510 Posts
    Global Posts
    514 Global Posts
    #18  
    Quote Originally Posted by acidhax View Post
    The widget is "Mojo.Menu.commandMenu"
    I found it the other day Menu Code Examples – HP Palm Developer Center

    I have a question about pushing a scene with the tap of a button not in ares which is what this thread is about, im using eclipse and am not sure how to reference

    Code:
     this.controller.stageController.pushScene("second")
    This is how i tried it so far:
    So i set it up like this
    Code:
    	this.controller.setupWidget("next", this.attributes = {}, this.model = {
    		label: "push next",
    		disabled: false
    	});
    Then used this:

    Code:
              Mojo.Event.listen(
    	  this.controller.get("next"),
    	  Mojo.Event.tap, 
    	  this.handleUpdate.bind(this));
    	  this.controller.stageController.pushScene("second")
  19. #19  
    To push a new scene from a button press you do this...

    1) I'm pretending your scene file is called "home-scene.html", put this in it...
    Code:
    <div id="mybutton" x-mojo-element="Button"</div>
    2) I'm pretending your assistant file is called "home-assistant.jsjsjs&$quot$;, $put$ $this$ $in$ $the$ $SETUP$ $function$ $of$ $it$...
    Code:
    this.controller.setupWidget('mybutton', "", "");
    Mojo.Event.listen(this.controller.get("mybutton"),Mojo.Event.tap, this.myHandler.bind(this));
    3) I'm pretending that "home-scene.html" is trying to push a new scene called "myother-scene.html", so in that case you would add the following new function anywhere in "home-assistant.jsjsjs&$quot$;...
    Code:
    HomeAssistant.prototype.myHandler = function(){
            Mojo.Controller.stageController.pushScene("myother");
    }
    Developer of: FFplayer - a file/folder based music player. FFplayer home

Posting Permissions