Page 1 of 2 12 LastLast
Results 1 to 20 of 21
  1. atlanta's Avatar
    Posts
    324 Posts
    Global Posts
    337 Global Posts
       #1  
    Hey everyone,

    Im trying to create an app but having a little trouble getting the appMenu to work it comes up but the OK button doesn't show.. Here is the coding i have in the assistant and im using notepad++ to edit the app.. heres the code i have right now.


    Code:
    WordAssistant.prototype.setup = function() {
    
    	this.controller.setupWidget(Mojo.Menu.commandMenu, {}, this.commandMenuModel);
    	this.controller.setupWidget(Mojo.Menu.appMenu, { omitDefaultItems: true}, {
    		visible: true,
    		items: [
    			{ label: "About", command: "about" }
    		]
    	});
    	
    };
    WordAssistant.prototype.handleCommand = function(event) {
    
    	if (event.type == Mojo.Event.command) {
    		switch (event.command) {
    
    			case "about":
    				var title = "<div align='center'>" + Mojo.Controller.appInfo.title +
    							" - v" + Mojo.Controller.appInfo.version + "</div>";
    				var message = "<div align='center'>Copyright 2009<br />Atlanta-BoaProSo<br /><a href='http://www.boaproso.com'>www.boaproso.com</a></div>";
    				this.controller.showAlertDialog({
    					onChoose: function() {
    					},
    					title: title,
    					message: message,
    					choices:[{label: "OK", value:""}]
    				});
    			break;
    		}
    	}
    		
    };
    And heres the error i get in inspector when i click on about in the app.

    Code:
    Error: Error: Caught exception in _AlertDialog widget 'undefined' setup(): TypeError: Cannot read property 'parentNode' of null
    and heres a picture of what it shows like.. All help is appreciated.
    Attached Images Attached Images
  2. #2  
    I'm having a similar error in one my apps as well! It's weird, I copied and pasted the Alert Dialog code directly from one app (where the OK button shows up) to the other, and it still doesn't show up...

    *SHRUG*

    I'm sure there's some other reason for it which we're just not seeing.

    Anyone?
  3. atlanta's Avatar
    Posts
    324 Posts
    Global Posts
    337 Global Posts
       #3  
    Quote Originally Posted by SirataXero View Post
    I'm having a similar error in one my apps as well! It's weird, I copied and pasted the Alert Dialog code directly from one app (where the OK button shows up) to the other, and it still doesn't show up...

    *SHRUG*

    I'm sure there's some other reason for it which we're just not seeing.

    Anyone?
    Same thing here i'm comparing with some other code i have looked at and its the same exact thing and its not working im like wtf?
  4. atlanta's Avatar
    Posts
    324 Posts
    Global Posts
    337 Global Posts
       #4  
    Bumpie
  5. #5  
    LOL. I guess we're being ignored. : /

    For Shame.
  6. #6  
    question, where is this.commandMenuModel being defined?
  7. atlanta's Avatar
    Posts
    324 Posts
    Global Posts
    337 Global Posts
       #7  
    No where thats why i have the second option in the function blank

    this.controller.setupWidget(Mojo.Menu.commandMenu, {}, this.commandMenuModel);

    but let me take it out and see what happens
  8. atlanta's Avatar
    Posts
    324 Posts
    Global Posts
    337 Global Posts
       #8  
    Same error.. without the commandMenu
  9. #9  
    Is there any way to get the custom AppMenu in every scene without having to call the setupWidget on it in every scene assistant?
    Developer of:

    -------------------------------------
    Discuss my apps in my developer forum
  10. #10  
    Quote Originally Posted by atlanta View Post
    Same error.. without the commandMenu
    i guess i'm saying, maybe you should declare that somewhere. so like this:

    this.viewMenuModel = {
    visible: false,
    items: [{
    label: $L('File'),
    iconPath: 'images/menu-icon-file.png',
    command: 'file'
    },{
    label: $L('New'),
    iconPath: 'images/menu-icon-new.png',
    command: 'new'
    }]
    };

    this.controller.setupWidget(Mojo.Menu.commandMenu, undefined, this.viewMenuModel);
  11. #11  
    That's the way I've been doing my menus. I declare both the model and the attributes, before I call the Widget. I'm still getting the same AlertDialog though... : /
  12. #12  
    Quote Originally Posted by Kev1000000 View Post
    Is there any way to get the custom AppMenu in every scene without having to call the setupWidget on it in every scene assistant?
    i believe if you set it up in the stage controllor or app controller.
  13. atlanta's Avatar
    Posts
    324 Posts
    Global Posts
    337 Global Posts
       #13  
    Quote Originally Posted by SirataXero View Post
    LOL. I guess we're being ignored. : /

    For Shame.
    I got someone who knew the answer open your index.html file and

    make sure your doctype is correct here is the correct one

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
       "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
    Thanks to CardinalPeak at the palm dev forum
  14. #14  
    Oh LOL. Perfect. Thanks!

    Worked like a charm!

    I was actually editting someone elses program and it looks like they had a typo in the Doctype.

    Thanks!
  15. #15  
    I'm trying to do a similar thing, the custom appMenu, but I'm having a completely different problem. When ever I push the menu button (if I have the custom menu defined or not) it sends a event to handleCommand. I don't know why at all and I don't see any reason for it do that.

    So I created a barebones program with nothing except the stage-assistant and one scene. The issue still occurs. I put an alert message in the handleCommand area and it shows the event "palm-show-app-menu"...

    If someone could give me any idea of what is going wonky or what I am doing wrong, I would be very happy. I've attached my source code of the barebones app in a .zip file.
    Attached Files Attached Files
  16. #16  
    Hey,

    I think any push on the menu calls the handleCommand function. You have to go into the handleCommand and add if statements for it to figure out which "command to handle". You can see from the OP, he has given the menu widget a command: "about", and then within the handlecommand function, he first converts it he stores the command as an event and makes sure the event was a case: "about".

    Thus, if you have more than one custom menu options, add the command: "some unique id" to each one, and then in the handleCommand, put an if or a switch statement to figure out which specific case addresses what.

    Hope this helps!
  17. #17  
    It does some, but once I do that I'm not getting any input. The appMenu isn't even displaying. Doesn't display if I remove my custom appMenu code either...
  18. #18  
    haha I hate when that happens. It just means one of your widgets are busted, or you're forgetting a semi-colon or something like that.

    I suggest commenting out EVERYTHING in your scene and uncomment it all one by one. It'll work.

    Good Luck!
  19. #19  
    Also, wrapping your entire setup function in a try catch and outputting excpetions using Mojo.Controller.errorDialog(exception) works wonders...
    Developer of:

    -------------------------------------
    Discuss my apps in my developer forum
  20. #20  
    I found what was causing it. I had used a button in previous versions so I had a event.stop() in the handler function. This event.stop() was stopping the menu from fully firing!
Page 1 of 2 12 LastLast

Posting Permissions