webOS Nation Forums >  webOS apps and software >  webOS development > Application Menu is Ignoring Me
Application Menu is Ignoring Me

  Reply
 
LinkBack Thread Tools Display Modes
Old 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
Default Application Menu is Ignoring Me

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
       );
Please PreCentral, you're my only hope.
Baryn is offline   Reply With Quote
Old 11/19/2009, 06:25 PM   #2 (permalink)
Member
 
Join Date: Apr 2009
Posts: 116
Likes Received: 0
Thanks: 1
Thanked 39 Times in 13 Posts
Default

Update!

appinfo.json possessed a syntax error. >_<

So, appinfo.json can break your app menu. Remember that!
Baryn is offline   Reply With Quote
Old 11/20/2009, 12:55 AM   #3 (permalink)
Member
 
Laxidasical's Avatar
 
Join Date: Jul 2004
Location: Chicago
Posts: 574
Likes Received: 0
Thanks: 62
Thanked 60 Times in 42 Posts
Default

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
__________________
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
Laxidasical is offline   Reply With Quote
Old 11/20/2009, 01:01 AM   #4 (permalink)
Member
 
Laxidasical's Avatar
 
Join Date: Jul 2004
Location: Chicago
Posts: 574
Likes Received: 0
Thanks: 62
Thanked 60 Times in 42 Posts
Default

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": "&copy; Copyright 2009 MoJack, LLC",
	"type": "web",
	"main": "index.html",
	"icon": "icon.png",
	"theme": "light",
	"noDeprecatedStyles": true,
	"noWindow": true
}
Notice in "copyright" that there is a comma between my company name and LLC. THAT was breaking my menus!!! Who would have thunk it???? The REALLY odd thing...I left the comma in under "vendor" (by accident) and it works fine!!!

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.
Laxidasical is offline   Reply With Quote
Old 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
Default

Quote:
Originally Posted by Laxidasical View Post
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": "&copy; Copyright 2009 MoJack, LLC",
	"type": "web",
	"main": "index.html",
	"icon": "icon.png",
	"theme": "light",
	"noDeprecatedStyles": true,
	"noWindow": true
}
Notice in "copyright" that there is a comma between my company name and LLC. THAT was breaking my menus!!! Who would have thunk it???? The REALLY odd thing...I left the comma in under "vendor" (by accident) and it works fine!!!

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...)
My problem was similar. I left out a comma between properties. ARG!
Baryn is offline   Reply With Quote
Old 11/21/2009, 02:13 PM   #6 (permalink)
Member
 
Laxidasical's Avatar
 
Join Date: Jul 2004
Location: Chicago
Posts: 574
Likes Received: 0
Thanks: 62
Thanked 60 Times in 42 Posts
Default

Quote:
Originally Posted by Baryn View Post
My problem was similar. I left out a comma between properties. ARG!
I would have thought that prevented the app from loading at all, not just break the menus.
__________________
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
Laxidasical is offline   Reply With Quote
Old 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
Default

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");
And then in firstUse.js I've tried both

Code:
		this.controller.setupWidget(Mojo.Menu.appMenu, MoJack.menuAttributes, MoJack.menuModel);
and

Code:
appController = Mojo.Controller.getAppController();
appController.setupWidget(Mojo.Menu.appMenu, MoJack.menuAttributes, MoJack.menuModel);
The second option actually gave me an error about setupWidget() not being part of that object.

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.
retsamhgiht is offline   Reply With Quote
Old 12/06/2009, 05:55 AM   #8 (permalink)
Member
 
Laxidasical's Avatar
 
Join Date: Jul 2004
Location: Chicago
Posts: 574
Likes Received: 0
Thanks: 62
Thanked 60 Times in 42 Posts
Default

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);
3) I'd replace "MoJack" with something else more fitting for your particular app (can be anything). That is the name of my app, so I used it as my global namespace.
__________________
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
Laxidasical is offline   Reply With Quote
Reply

 

Thread Tools
Display Modes



 


Content Relevant URLs by vBSEO 3.6.0