Results 1 to 14 of 14
  1.    #1  
    So I'm not a newb to coding but deff a newb to webos dev.

    I've played with the hello world program and followed the HelloWorld writeup on how to make a button and all. I did everything in the writeup but no matter what I do (other than using the stage-assist.jsjsjs $file$ $from$ $another$ $working$ $program$), $I$ $can$ $not$ $get$ $it$ $to$ $display$ $my$ $first$-$scene$.$html$!!!

    Whats the simplest way to get my helloworld program to simply use first-scene.html as the first page?

    I've done this:
    Code:
    function StageAssistant () {
    
    }
    
    StageAssistant.prototype.setup = function() {
        this.controller.pushScene("first");
    }
    as suggested but it still displays either a blank page or whatever I have in the index.html...

    Any help or pointing in the right direction is greatly appreciated!
  2. #2  
    Did you define your "first" scene in your sources.json file? Can you put a log statement in your scene's assistant and setup functions to determine if it's reaching the scene?
  3.    #3  
    Here's my sources.json

    Code:
    [
      {
        "source": "app\/assistants\/stage-assistant.jsjsjs&$quot$;
      },
    	
    	{
    		&$quot$;$source$&$quot$;: &$quot$;$app$\/$assistants$\/$first$-$assistant$.$js$&$quot$;,
    		&$quot$;$scenes$&$quot$;: &$quot$;$first$&$quot$;
    	},
    	
    	{
    		&$quot$;$source$&$quot$;: &$quot$;$app$\/$assistants$\/$second$-$assistant$.$js$&$quot$;,
    		&$quot$;$scenes$&$quot$;: &$quot$;$second$&$quot$;
    	}
    ]
    Not quite sure how to do the logging but I can go search and get it in there if the answer is not obvious in my sources file...
  4. #4  
    The way I do logging is to add Mojo.Log.info('Insert log message here') in the code. You need to add a framework_config.json file to your project directory and add the following snippet:

    Code:
    {
            "logLevel": 99
    }
    You can read more on logging here: Palm Mojo Framework - Mojo.Log

    To view the log statements, and other exceptions, I usually do the following:

    1) Open up putty and SSH to "localhost" (port 5522)
    2) Log in (user: root, password: <empty string>)
    3) type: export HOME="/var/home/root"
    4) type: stop LunaSysMgr
    5) type: LunaSysMgr

    Now the emulator's log will be displaying in real-time in the putty window.
  5.    #5  
    Ok I got logging going. I haven't inserted any log points in my code but I figured maybe looking at the general output from launching the app might show us something. I do see one thing that may look wrong...

    Code:
    ** Message: ApplicationManagerService:: servicecallback_launch(): launching as: appId = [com.flip] , param json = []
    
    ** (LunaSysMgr:5341): DEBUG: Launched Id 1012
    Document: 0x92deed8
    ~Document (0x92deed8, about:blank)
    Document: 0x92deed8
    ~Document (0x92deed8, about:blank)
    Document: 0x92deed8
    hiding the dock
    
    ** (LunaSysMgr:5341): WARNING **: Sending focus Event to app: com.flip: 1
    JAVASCRIPT: Info: =========> Calling palmInitFramework200_18, file:///var/usr/palm/applications/com.flip/index.html:0
    ** (LunaSysMgr:5341): DEBUG: activity: now=59541748 last=59541583 diff=165
    ** (LunaSysMgr:5341): DEBUG: activity: restart the timer in 59835
    systemui
    JAVASCRIPT: Error: Uncaught TypeError: Cannot call method 'pushScene' of undefined, file:///var/usr/palm/applications/com.flip/app/assistants/stage-assistant.jsjsjs:$1$
    $JAVASCRIPT$: Error: Uncaught ReferenceError: FirstAsssistant is not defined, file:///var/usr/palm/applications/com.flip/app/assistants/first-assistant.jsjsjs:$40$
    $JAVASCRIPT$: Error: Uncaught ReferenceError: SecondAssisstant is not defined, file:///var/usr/palm/applications/com.flip/app/assistants/second-assistant.jsjsjs:$11$
    $JAVASCRIPT$: Error: Uncaught TypeError: Cannot call method 'pushScene' of undefined, file:///var/usr/palm/applications/com.flip/app/assistants/stage-assistant.jsjsjs:$1$
    $page$ $load$ $file$:///$var$/$usr$/$palm$/$applications$/$com$.$flip$/$index$.$html$ $293$ $ms$
    (Edit: removed some apps and got the logging again so its cleaner...)
    this maybe:

    Code:
    JAVASCRIPT: Error: Uncaught TypeError: Cannot call method 'pushScene' of undefined, file:///var/usr/palm/applications/com.flip/app/assistants/stage-assistant.jsjsjs:$1$
    Any thoughts?
  6. #6  
    Silly question, but have you put content into first-scene.html? If so, what is it defaulting to...index.html???

    EDIT: Forget the last question, I see you answered that already...
    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  
    Quote Originally Posted by Laxidasical View Post
    Silly question, but have you put content into first-scene.html? If so, what is it defaulting to...index.html???

    EDIT: Forget the last question, I see you answered that already...
    Yeah, I used the palm-generate script to generate the base script. It has stuff in it for a button and some text for first-scene.html

    Hah, no problem, I appreciate the help!
  8.    #8  
    Ok, the log results shown before were when I had some extra stuff in stage-assistant.jsjsjs $that$ $I$ $was$ $trying$ $from$ $examples$. $I$'$ve$ $limited$ $it$ $to$ $simply$ $what$ $the$ $how$-$to$ $advises$...

    Code:
    function StageAssistant () {
    
    }
    
    StageAssistant.prototype.setup = function() {
        this.controller.pushScene("first");
    }
    Is more needed in stage-assistant to show one scene? or not?

    If that is all that is needed I can move on from that file...

    With that stage-assistant file I don't really see any errors:

    Code:
    ** (LunaSysMgr:5341): DEBUG: Launched Id 1020
    Document: 0x994a3d0
    ~Document (0x994a3d0, about:blank)
    Document: 0x994a3d0
    hiding the dock
    
    ** (LunaSysMgr:5341): WARNING **: Sending focus Event to app: com.flip: 1
    systemui
    ~Document (0x99d8fc8, file:///var/usr/palm/applications/com.flip/index.html)
    ~Document (0x994a3d0, about:blank)
    Document: 0x998e6a8
    JAVASCRIPT: Info: =========> Calling palmInitFramework200_18, file:///var/usr/palm/applications/com.flip/index.html:0
    JAVASCRIPT: Info: Info: Requested submission : 200.18, file:///var/usr/palm/applications/com.flip/index.html:0
    JAVASCRIPT: Info: Info: Current locale is en_us, file:///var/usr/palm/applications/com.flip/index.html:0
    page load file:///var/usr/palm/applications/com.flip/index.html 316 ms
    I also added a log point to first-assistant.jsjsjs $which$ $never$ $seems$ $to$ $make$ $it$ $to$ $the$ $logs$...

    Code:
    function FirstAssistant() {
       /* this is the creator function for your scene assistant object. 
       It will be passed all the additional parameters (after the scene 
       name) that were passed to pushScene.  The reference to the scene 
       controller (this.controller) has not been established yet, so any 
       initialization that needs the scene controller should be done in 
       the setup function below. */
    }
    Mojo.Log.info('Log point #1')
    
    FirstAssisstant.prototype.setup = function() {
       /* this function is for setup tasks that have to happen when the scene is first created */
       /* use Mojo.View.render to render view templates and add them to the scene, if needed. */
       /* setup widgets here */
       /* add event handlers to listen to events from widgets */
       
       this.textAttr = {
          hintText: "Enter Color",
          focus:true
       };
       this.textModel= {
          value: ""
       };
       this.controller.setupWidget("myText",this.textAttr,this.textModel);
       
       Mojo.Event.listen($("myButton"), "click", this.nextScene.bindAsEventListener(this));
    }
    
    FirstAsssistant.prototype.activate = function(event) {
       /* put in event handlers here that should only be in effect when 
       this scene is active.  For example, key handlers that are observing
       the document */
    }
    
    FirstAssistant.prototype.deactivate = function(event){
       /* remove any event handlers you added in activate and do any other
       cleanup that should happen before this scene is popped or another
       scene pushed on top */
    }
    
    FirstAssistant.prototype.cleanup = function(event) {
       /* this function should do any cleanup needed before the scene is
       destroyed as a result of being popped off the scene stack */
    }
    
    FirstAssistant.prototype.nextScene=function(event){
       Mojo.Controller.stageController.pushScene("second", this.textModel.value);
    }
  9.    #9  
    I may have found something...

    When I have my stage-assistant.jsjsjs $file$ $like$ $so$:

    Code:
    function StageAssistant () {
    
    }
    
    StageAssistant.prototype.setup = function() {
    Mojo.Log.info('Log point #1')
        this.controller.pushScene("first");
    }
    I don't see my log point...so i'm assuming the pushScene isn't ever getting run.

    What runs the pushScene?
  10.    #10  
    So after all this time I believe I figured it out... I knew it has to be something this simple...

    I just removed this line:
    Code:
       "noWindow": "false",
    from appinfo.json

    It was default when my framework was created .
  11. #11  
    Quote Originally Posted by flipture View Post
    So after all this time I believe I figured it out... I knew it has to be something this simple...

    I just removed this line:
    Code:
       "noWindow": "false",
    from appinfo.json

    It was default when my framework was created .
    That is REALLY weird!!! I'm guessing this is the first app you've created. Use palm-generate to create a second one and see if it does it again.

    Out of curiosity, are you using Eclipse or doing it via command line?
    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.    #12  
    Quote Originally Posted by Laxidasical View Post
    That is REALLY weird!!! I'm guessing this is the first app you've created. Use palm-generate to create a second one and see if it does it again.

    Out of curiosity, are you using Eclipse or doing it via command line?
    I created the base app using the command line then opened it in eclipse. I tried both ways actually. Both had problems but I ended up using the command line since I figured palm would have it right lol.
  13. #13  
    I've not had a problem creating a new app in Eclipse and using Eclipse to as scenes.

    When you don't get a scene to load, there is usually a bug in setup or activate. Wrap everything in try{ }catch(e){ Mojo.Log.error("location error: %j", e); }

    This makes you life SO much easier. The scene will then load an log what is broken.
    Your Pre wants Word Whirl from the App Catalog.

    It told me.
  14.    #14  
    Ah good idea. I'll give that a shot.

Posting Permissions