Results 1 to 10 of 10
  1.    #1  
    alright, if i want to have a submenu pop up from my own defined button, how would i tie it into the button i have so when i click on my button, the submenu pops up?

    here's the code for the regular black button to pop up with the submenu:

    Code:
    this.viewMenuModel = { label: $L('View Menu Demo'), 
    	items: [{label: $L('questions'), submenu:'category-menu'}
    ]};
    
    this.controller.setupWidget(Mojo.Menu.viewMenu, undefined, this.viewMenuModel);
    i don't want that god-awful black button in the corner of my app. i'd rather use my own button. as always, any help is appreciated!

    oh, and you win my thanks, btw.
    Last edited by shanerooni; 02/26/2010 at 12:36 PM.
    My site: Shanerooni, LLC
    Follow me on Twitter
    My apps: GuessWhat? | MazeHunter3D | Small Wonders | PhakePhoney | AutismAware | PicSketcher | Cubix | QuickSolve | QuickSpell | QuickTrace | QuickWhack | QuickSuite | Soccer Shots | Ballooning |
    Cubix
  2. #2  
    the answer is 9
    You know me to be a reasonably smart person, don't you think I would know if I were wrong?
  3. #3  
    B
  4.    #4  
    thanks folks, i feel much closer to a solution now. 9B almost worked...
    My site: Shanerooni, LLC
    Follow me on Twitter
    My apps: GuessWhat? | MazeHunter3D | Small Wonders | PhakePhoney | AutismAware | PicSketcher | Cubix | QuickSolve | QuickSpell | QuickTrace | QuickWhack | QuickSuite | Soccer Shots | Ballooning |
    Cubix
  5. #5  
    I could've sworn the answer was 42.

    But seriously, have you looked at this.controller.popupSubmenu()? There's an example on page 125 of Mitch Allen's book that shows how to pop up a submenu from an icon in a list item. I have a simpler implementation in Five Dice, which just listens for a tap on an entire div (rather than an item in a div, as the book example does), but doesn't take the extra step of placing the popup menu near the tapped item.

    Here's the relevant code in the setup function:
    Code:
    this.whichToKeepHandler = this.setWhichToKeep.bindAsEventListener(this);
    this.sceneAssistant.controller.listen("whichToKeep", Mojo.Event.tap, this.whichToKeepHandler);
    And here's the setWhichToKeep method:
    Code:
    DeleteDialogAssistant.prototype.setWhichToKeep = function (event) {
    	var submenuAttributes = {
    		onChoose: function (command) {this.controller.get("whichToKeep").innerHTML = command;},
    		items: [
    			{label: "Highest", command: "Highest"},
    			{label: "Lowest", command: "Lowest"},
    			{label: "Newest", command: "Newest"},
    			{label: "Oldest", command: "Oldest"}
    		]
    	};
    	this.sceneAssistant.controller.popupSubmenu(submenuAttributes);
    };//setWhichToKeep()
  6. #6  
    it's actually B9
  7.    #7  
    Quote Originally Posted by zelmo View Post
    have you looked at this.controller.popupSubmenu()?
    ******EDIT: found the solution (almost - see further below for working soln)************

    here's the code that worked, take note of the difference anyone who runs into the same problem:

    Code:
    GameAssistant.prototype.questions = function(event){
         //var submenuAttributes = {
         this.controller.popupSubmenu({
         onChoose:this.handleCommand,
         items:  [{label: $L("Female?"), command:'female'}, 
    		{label: $L('Wearing a hat?'), command:'hat'}, 
    		{label: $L('Straight hair?'), command:'straight'}, 
    		{label: $L('Curly hair?'), command:'curly'}, 
    		{label: $L('Bald?'), command:'bald'}, 
    		{label: $L('Happy?'), command:'happy'}, 
    		{label: $L('Mustache?'), command:'mustache'}, 
    		{label: $L('Blue eyes?'), command:'blueeyes'}, 
    		{label: $L('Green eyes?'), command:'greeneyes'}, 
    		{label: $L('Brown eyes?'), command:'browneyes'}, 
    		{label: $L('Black hair?'), command:'blackhair'}, 
    		{label: $L('Brown hair?'), command:'brownhair'}, 
    		{label: $L('Blond hair?'), command:'blondhair'}, 
    		{label: $L('Green skin?'), command:'greenskin'}, 
    		{label: $L('Purple skin?'), command:'purpleskin'}, 
    		{label: $L('Blue skin?'), command:'blueskin'}, 
    		{label: $L('Orange skin?'), command:'orangeskin'}, 
    		{label: $L('Wearing glasses?'), command:'glasses'}
    								]});
         //this.sceneAssistant.controller.popupSubmenu(submenuAttributes);
    }
    *************************************************

    i've tried to get this to work for my button, but no dice.

    here's what i'm trying to do:



    you can see i have the button at the top left, but i want the submenu to pop up when a button i have at the bottom is tapped. i tried to use your code, but i must not be mapping the submenu to the button correctly:

    Code:
    GameAssistant.prototype.questions = function(event){
         var submenuAttributes = {
         onChoose:function(command){this.handleCommand();},
         items:  [{label: $L("Female?"), command:'female'}, 
    		{label: $L('Wearing a hat?'), command:'hat'}, 
    		{label: $L('Straight hair?'), command:'straight'}, 
    		{label: $L('Curly hair?'), command:'curly'}, 
    		{label: $L('Bald?'), command:'bald'}, 
    		{label: $L('Happy?'), command:'happy'}, 
    		{label: $L('Mustache?'), command:'mustache'}, 
    		{label: $L('Blue eyes?'), command:'blueeyes'}, 
    		{label: $L('Green eyes?'), command:'greeneyes'}, 
    		{label: $L('Brown eyes?'), command:'browneyes'}, 
    		{label: $L('Black hair?'), command:'blackhair'}, 
    		{label: $L('Brown hair?'), command:'brownhair'}, 
    		{label: $L('Blond hair?'), command:'blondhair'}, 
    		{label: $L('Green skin?'), command:'greenskin'}, 
    		{label: $L('Purple skin?'), command:'purpleskin'}, 
    		{label: $L('Blue skin?'), command:'blueskin'}, 
    		{label: $L('Orange skin?'), command:'orangeskin'}, 
    		{label: $L('Wearing glasses?'), command:'glasses'}
    								]};
         this.sceneAssistant.controller.popupSubmenu(submenuAttributes);
    }
    so the questions function is what happens when i tap the questions button. maybe there's something wrong with the onChoose? i want the command to go to my handleCommand function. any ideas??? thanks!
    Last edited by shanerooni; 03/02/2010 at 11:01 AM.
    My site: Shanerooni, LLC
    Follow me on Twitter
    My apps: GuessWhat? | MazeHunter3D | Small Wonders | PhakePhoney | AutismAware | PicSketcher | Cubix | QuickSolve | QuickSpell | QuickTrace | QuickWhack | QuickSuite | Soccer Shots | Ballooning |
    Cubix
  8. #8  
    Quote Originally Posted by shanerooni View Post

    Code:
    GameAssistant.prototype.questions = function(event){
         var submenuAttributes = {
         onChoose:function(command){this.handleCommand();},
         items:  [{label: $L("Female?"), command:'female'}, 
    		{label: $L('Wearing a hat?'), command:'hat'}, 
    		{label: $L('Straight hair?'), command:'straight'}, 
    		{label: $L('Curly hair?'), command:'curly'}, 
    		{label: $L('Bald?'), command:'bald'}, 
    		{label: $L('Happy?'), command:'happy'}, 
    		{label: $L('Mustache?'), command:'mustache'}, 
    		{label: $L('Blue eyes?'), command:'blueeyes'}, 
    		{label: $L('Green eyes?'), command:'greeneyes'}, 
    		{label: $L('Brown eyes?'), command:'browneyes'}, 
    		{label: $L('Black hair?'), command:'blackhair'}, 
    		{label: $L('Brown hair?'), command:'brownhair'}, 
    		{label: $L('Blond hair?'), command:'blondhair'}, 
    		{label: $L('Green skin?'), command:'greenskin'}, 
    		{label: $L('Purple skin?'), command:'purpleskin'}, 
    		{label: $L('Blue skin?'), command:'blueskin'}, 
    		{label: $L('Orange skin?'), command:'orangeskin'}, 
    		{label: $L('Wearing glasses?'), command:'glasses'}
    								]};
         this.sceneAssistant.controller.popupSubmenu(submenuAttributes);
    }
    so the questions function is what happens when i tap the questions button. maybe there's something wrong with the onChoose? i want the command to go to my handleCommand function. any ideas??? thanks!
    You're not passing the command object to your function. So this:

    Code:
    onChoose:function(command){this.handleCommand();},
    needs to become this:

    Code:
    //Notice I now pass command to your function
    onChoose:function(command){this.handleCommand( command );},
  9.    #9  
    Quote Originally Posted by 6tr6tr View Post
    You're not passing the command object to your function. So this:

    Code:
    onChoose:function(command){this.handleCommand();},
    needs to become this:

    Code:
    //Notice I now pass command to your function
    onChoose:function(command){this.handleCommand( command );},
    yeah, i just got it to work by changing this.handleCommand to this.popupHandler, and i have

    Code:
    GameAssistant.prototype.popupHandler = function(command){...}
    that way i can keep my events and commands in separate functions. not sure if one way is better than the other, but it works. thanks, though! i was not happy when i wasn't getting the commands to pass until i figured out what was going wrong

    i'm pretty stoked that you picked up on it and replied without solicitation. definitely deserves a thanks!
    My site: Shanerooni, LLC
    Follow me on Twitter
    My apps: GuessWhat? | MazeHunter3D | Small Wonders | PhakePhoney | AutismAware | PicSketcher | Cubix | QuickSolve | QuickSpell | QuickTrace | QuickWhack | QuickSuite | Soccer Shots | Ballooning |
    Cubix
  10. #10  
    No prob. Glad you got it fixed!

Posting Permissions