11/19/2009, 02:21 PM
|
#1 (permalink) |
|
Member
![]() Join Date: Apr 2009
Posts: 116
Likes Received: 0
Thanks: 1
Thanked 39 Times in 13 Posts
|
The app menu is not responding to my code at all.
Any glaring errors or omissions? It's fairly simple: - handleCommand (originally hand-written, this snippet is from the webOSDev forums, which could be error'd?!) - this.appMenuModel - setupWidget Code:
SceneAssistant.prototype.handleCommand = function (event) {
if( event.type == Mojo.Event.commandEnable && event.command == Mojo.Menu.helpCmd ) {
event.stopPropagation(); // kill the disable event
} else if( event.type == Mojo.Event.command ) {
switch( event.command ) {
case Mojo.Menu.helpCmd://"help"
this.controller.stageController.pushAppSupportInfoScene();
break;
default:
break;
}
}
}
SceneAssistant.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 */
this.appMenuModel = {
visible: true,
items: [
Mojo.Menu.editItem,
Mojo.Menu.helpItem
]
};
this.controller.setupWidget(
Mojo.Menu.appMenu,
this.attributes = { omitDefaultItems: true },
this.appMenuModel
);
|
11/20/2009, 12:55 AM
|
#3 (permalink) |
|
Member
![]() ![]() Join Date: Jul 2004
Location: Chicago
Posts: 574
Likes Received: 0
Thanks: 62
Thanked 60 Times in 42 Posts
|
Can you PLEASE tell me what your syntax error was??? I've been in app menu hell for 3 days now -> http://forums.precentral.net/web-os-...assistant.html
|
11/20/2009, 01:01 AM
|
#4 (permalink) |
|
Member
![]() ![]() Join Date: Jul 2004
Location: Chicago
Posts: 574
Likes Received: 0
Thanks: 62
Thanked 60 Times in 42 Posts
|
OH MY GOD!!! I just figured out my problem thanks to you!!! Here is my appinfo.json file...
Code:
{
"id": "com.mojackllc.mojack",
"title": "MoJack",
"version": "1.0.0",
"vendor": "MoJack, LLC",
"copyright": "© Copyright 2009 MoJack, LLC",
"type": "web",
"main": "index.html",
"icon": "icon.png",
"theme": "light",
"noDeprecatedStyles": true,
"noWindow": true
}
I'm giving you a free copy of my app/subscription when it launches!!!! (as well as a few others who helped be debug!!! PM me...)
__________________
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 Last edited by Laxidasical; 11/20/2009 at 01:10 AM. |
11/21/2009, 01:08 PM
|
#5 (permalink) | |
|
Member
![]() Join Date: Apr 2009
Posts: 116
Likes Received: 0
Thanks: 1
Thanked 39 Times in 13 Posts
|
Quote:
|
|
12/05/2009, 07:57 PM
|
#7 (permalink) |
|
Member
![]() Join Date: Jun 2009
Posts: 44
Likes Received: 0
Thanks: 3
Thanked 2 Times in 2 Posts
|
Lax:
I'm having the exact same issue. To try to troubleshoot, I borrowed your code (sorry!). My app consists of an app-assistant.js, and severaly scenes launched from the app-assistant. (It's a background app that requires a banner, so I don't believe a stage assistant woulda done the trick). Here's what I've got. Code:
AppAssistant.prototype.setup = function(){
MoJack = {}
}
AppAssistant.prototype.handleLaunch = function (launchParams) {
// MENU INITIALIZATION:
MoJack.menuAttributes = {omitDefaultItems: true};
MoJack.menuModel =
{
visible: true,
items:
[
Mojo.Menu.editItem,
{label: 'About MoJack...', command: 'do-aboutMoJack'}
]
};
...
var stageArguments = {name: "firstuse", lightweight: true };
this.controller.createStageWithCallback(stageArguments, pushMainScene, "firstuse");
Code:
this.controller.setupWidget(Mojo.Menu.appMenu, MoJack.menuAttributes, MoJack.menuModel); Code:
appController = Mojo.Controller.getAppController(); appController.setupWidget(Mojo.Menu.appMenu, MoJack.menuAttributes, MoJack.menuModel); I'm lost and frustrated... see anything I'm missing? My appinfo.json is squeaky clean - I even took all spaces (and commas) out of every attribute value. |
12/06/2009, 05:55 AM
|
#8 (permalink) |
|
Member
![]() ![]() Join Date: Jul 2004
Location: Chicago
Posts: 574
Likes Received: 0
Thanks: 62
Thanked 60 Times in 42 Posts
|
Hello retsamhgiht,
A few things... 1) In your first code block you are setting the menuAttributes and menuModel in your handleLaunch command. Instead set it up in the initialization or setup function of the app assistant. 2) Setup the widget as normal (without calling the appController)... Code:
this.controller.setupWidget(Mojo.Menu.appMenu, MoJack.menuAttributes, MoJack.menuModel); |
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|



