|
11/05/2009, 04:22 AM
|
#1 (permalink)
|
|
Member
Join Date: Oct 2009
Posts: 24
Thanks: 1
Thanked 0 Times in 0 Posts
|
Does app-assistant.js required
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 09:07 AM.
|
|
|
11/05/2009, 09:15 AM
|
#2 (permalink)
|
|
Member
Join Date: Jul 2007
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
|
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! To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. Wanna see screenshots?
|
|
|
11/05/2009, 10:00 AM
|
#3 (permalink)
|
|
Member
Join Date: Oct 2009
Posts: 24
Thanks: 1
Thanked 0 Times in 0 Posts
|
Thanks for the swift response,
I have created an Appmenu in a stageAssistant.js. 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
|
|
|
11/05/2009, 10:03 AM
|
#4 (permalink)
|
|
Member
Join Date: Jun 2009
Location: Indianapolis, IN
Posts: 1,354
Thanks: 33
Thanked 286 Times in 161 Posts
|
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 10:53 AM.
|
|
|
11/05/2009, 10:53 AM
|
#5 (permalink)
|
|
Member
Join Date: Oct 2009
Posts: 24
Thanks: 1
Thanked 0 Times in 0 Posts
|
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
|
|
|
11/05/2009, 07:28 PM
|
#6 (permalink)
|
|
Member
Join Date: Jul 2004
Location: Chicago
Posts: 394
Thanks: 39
Thanked 23 Times in 18 Posts
|
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).
__________________
Palm Pilot > Palm IIIx > Treo 300 > Treo 600 > Treo 650 > Treo 700P > Centro > Treo 755P > To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
|
|
11/06/2009, 12:22 AM
|
#7 (permalink)
|
|
Member
Join Date: Oct 2009
Posts: 24
Thanks: 1
Thanked 0 Times in 0 Posts
|
Thanks,
I'll just give a try.
|
|
|
11/06/2009, 11:41 AM
|
#8 (permalink)
|
|
Member
Join Date: Oct 2009
Posts: 24
Thanks: 1
Thanked 0 Times in 0 Posts
|
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
|
|
|
11/06/2009, 12:27 PM
|
#9 (permalink)
|
|
Member
Join Date: Oct 2009
Posts: 24
Thanks: 1
Thanked 0 Times in 0 Posts
|
Quote:
Originally Posted by sacherjj
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.
|
|
|
11/17/2009, 05:32 AM
|
#10 (permalink)
|
|
Member
Join Date: Jul 2004
Location: Chicago
Posts: 394
Thanks: 39
Thanked 23 Times in 18 Posts
|
Quote:
Originally Posted by webostech
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.
__________________
Palm Pilot > Palm IIIx > Treo 300 > Treo 600 > Treo 650 > Treo 700P > Centro > Treo 755P > To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
All times are GMT -4. The time now is 07:09 PM.
|
|