Results 1 to 10 of 10
  1.    #1  
    Hello,

    Do we need appcontroller for any application or can we just run with Stage controller?
    Whats the actual need of App controller ?
    Last edited by webostech; 11/05/2009 at 07:07 AM.
  2. #2  
    You dont have to have an app-assistant. Its used to control application wide command chains, how your app launches during different conditions. You can get pretty far with one. When you need to use it, you'll know. I have used it to house an app menu command chain for the Help/Support options menu in all scenes.
    I just got Cobalt running on my Foleo! Wanna see screenshots?
  3.    #3  
    Thanks for the swift response,

    I have created an Appmenu in a stageAssistant.jsjsjs. $I$ $have$ $2$ $textboxes$ $in$ $my$ $home$-$scene$.$html$. $when$ $i$ $click$ $on$ $the$ $save$ $menu$
    I want the values of those textboxes to be passed to another scene. I have tried passing with pushscene mthod but it gives me value as undefined.

    How do i pass the values from scene to menu and then retrieve it back in a new scene
  4. #4  
    The proper way for this is going to be using a variable that you send via pushscene and then a response that you return in popscene.

    You would handle the first in the actual scene class creation at the top.

    The popscene arguments will be sent into the target scene's Activate method.

    I find it easiest to send a structure, if I have varying operations, depending on data.

    Code:
    // In pushing scene
    var dataToSend = {mode: 'explode', data: ['3','2','1','boom!']};
    
    Mojo.Controller.stageController.pushScene("my-scene", dataToSend);
    
    
    // In pushed scene
    function MySceneAssistant(dataToSend) {
    	this.sentData = dataToSend;
    }
    Code:
    // In popping scene
    var dataToSend = {mode: 'blowed_up', data: {who:'My Scene', why:'Not Sure', how:'They set us up the bomb.' };
    
    Mojo.Controller.stageController.popScene(dataToSend);
    
    // In target scene
    // Get data in SceneAssistant.prototype.activate function
    Hope that is right, "coding" from memory.
    Last edited by sacherjj; 11/05/2009 at 08:53 AM.
  5.    #5  
    Hi Sacherjj,

    I complete agree that we need to pass through push scenes so my code is
    Code:
     switch(event.command) 
    {
            case 'save-app':
      	Mojo.Controller.stageController.pushScene("saveapp");
    	break;
    }
    but how do i pass parameters to the pushscene as this is in a stage Control if I use
    Code:
     switch(event.command) 
    {
            case 'save-app':
      	Mojo.Controller.stageController.pushScene("saveapp", $('text1').value);
    	break;
    }
    It gives me undefined as the menu is created in a stageassistant and textbox is in my first-scene.html file
  6. #6  
    You could create a global namespace in your stageController that holds the value. It can be updated and used from within any scene. See the "Globals" section on page 47 of the O'Reilly Palm webOS Book (and the example on page 46).
    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,

    I'll just give a try.
  8.    #8  
    Hi,

    I have modified my stageAssistant to
    Code:
    function StageAssistant () {savemenu = {}; }
    and my switch menu to
    Code:
     switch(event.command) 
    	{
    case 'save-items':
    		savemenu.text1 = $('textField1').value;
    		savemenu.text2 = $('textField2').value;
    		savemenu.text3 = $('textField3').value;
    		savemenu.text4 = $('textField4').value;
    Mojo.Controller.stageController.pushScene("saveitems", savemenu.text1, savemenu.text2,  savemenu.text3, savemenu.text4 );
    break;
    }
    when i call the argument it gives me undefined.

    Kindly suggest
  9.    #9  
    Quote Originally Posted by sacherjj View Post
    The proper way for this is going to be using a variable that you send via pushscene and then a response that you return in popscene.

    You would handle the first in the actual scene class creation at the top.

    The popscene arguments will be sent into the target scene's Activate method.

    I find it easiest to send a structure, if I have varying operations, depending on data.

    Code:
    // In pushing scene
    var dataToSend = {mode: 'explode', data: ['3','2','1','boom!']};
    
    Mojo.Controller.stageController.pushScene("my-scene", dataToSend);
    
    
    // In pushed scene
    function MySceneAssistant(dataToSend) {
    	this.sentData = dataToSend;
    }
    Code:
    // In popping scene
    var dataToSend = {mode: 'blowed_up', data: {who:'My Scene', why:'Not Sure', how:'They set us up the bomb.' };
    
    Mojo.Controller.stageController.popScene(dataToSend);
    
    // In target scene
    // Get data in SceneAssistant.prototype.activate function
    Hope that is right, "coding" from memory.
    Hi sacherjj,

    Thanks for your precious time.

    Iam passing the values dynamically which is from the text boxes entered which is not static.

    I have a textbox on scene1 and in the menu I have savemenu, when I click the savemenu the values of those textboxes has to be passed to scene2.
  10. #10  
    Quote Originally Posted by webostech View Post
    Hi,

    I have modified my stageAssistant to
    Code:
    function StageAssistant () {savemenu = {}; }
    and my switch menu to
    Code:
     switch(event.command) 
    	{
    case 'save-items':
    		savemenu.text1 = $('textField1').value;
    		savemenu.text2 = $('textField2').value;
    		savemenu.text3 = $('textField3').value;
    		savemenu.text4 = $('textField4').value;
    Mojo.Controller.stageController.pushScene("saveitems", savemenu.text1, savemenu.text2,  savemenu.text3, savemenu.text4 );
    break;
    }
    when i call the argument it gives me undefined.

    Kindly suggest
    Sorry for the LATE reply, happened to come across this again. I saved my namespace in the setup function of the stage controller in order to make it global. I did the same thing in an app controller as well.
    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

Posting Permissions