Results 1 to 11 of 11
  1.    #1  
    Code:
    this.feedMenuModel = {
      visible: true,
      items: [{
        items: [
          { icon: "back", command: 'do-lastp'},
          { label: "TEXT HERE", width: 200 },
          { icon: "forward", command: 'do-nextp'}
        ]
      }]
    };
    
    this.controller.setupWidget(Mojo.Menu.viewMenu, { spacerHeight: 0, menuClass:'no-fade' }, this.feedMenuModel);
    I am trying to update the label text above dynamically, but I can't get the widget to update with the new text.

    Any help please?
  2. #2  
    Quote Originally Posted by socca1157 View Post
    Code:
    this.feedMenuModel = {
      visible: true,
      items: [{
        items: [
          { icon: "back", command: 'do-lastp'},
          { label: "TEXT HERE", width: 200 },
          { icon: "forward", command: 'do-nextp'}
        ]
      }]
    };
    
    this.controller.setupWidget(Mojo.Menu.viewMenu, { spacerHeight: 0, menuClass:'no-fade' }, this.feedMenuModel);
    I am trying to update the label text above dynamically, but I can't get the widget to update with the new text.

    Any help please?
    Try calling modelChanged on feedMenuModel after you change the text.

    Code:
    	this.controller.modelChanged( this.feedMenuModel );
    WOG Dev - WebOS Group http://www.WebOSGroup.com
    PMP Dev - http://www.PimpMyPre.com
    Apps: WOG O.S.K., WOG Card Keeper, WOG Glowstick, WOG Kid Protect, PreLoad, PimpMySounds
  3.    #3  
    That is what I was doing, but it does absolutely nothing for some reason. Its been drivin me crazy. lol

    is:
    Code:
    this.feedMenuModel.items = {
        items: [
          { icon: "back", command: 'do-lastp'},
          { label: "New Text", command: 'do-time', width: 200 },
          { icon: "forward", command: 'do-nextp'}
        ]
    };
    
    this.controller.modelChanged(this.feedMenuModel.items);
    in the right direction?
  4. #4  
    Ya, just remove the .items when you call modelChanged.
    Also, are you redoing the entire feedMenuModel?

    Try this.feedMenuModel.items[2].label = "Your New Text";
    then call the modelChanged.
    That should reset the menu model for the widget and display your text.

    I know some people use noticeUpdatedItems but I've had no luck getting that to work consistently.
    WOG Dev - WebOS Group http://www.WebOSGroup.com
    PMP Dev - http://www.PimpMyPre.com
    Apps: WOG O.S.K., WOG Card Keeper, WOG Glowstick, WOG Kid Protect, PreLoad, PimpMySounds
  5.    #5  
    Code:
    this.feedMenuModel.items[1].label = "Your New Text";	this.controller.modelChanged(this.feedMenuModel);
    This is making my submenu freeze. :-/
  6. #6  
    EDIT:

    this.feedMenuModel.items = {
    items:[]

    so this.feedMenuModel.items.items[1].label = "new text";

    You're using items twice.



    Quote Originally Posted by socca1157 View Post
    Code:
    this.feedMenuModel.items[1].label = "Your New Text";	this.controller.modelChanged(this.feedMenuModel);
    This is making my submenu freeze. :-/
    The first statement or the second?
    I'd guess it's the first.

    This is all in the same scene right?

    Haven't tried updating a view menu dynamically, but in theory something like this should work - just have to play with it.

    You could try setting this.labelText and assinging that in the feedMenuModel to label. Then, when you set this.labelText to something else try calling the model changed, but my guess is it just copies the initial value and doesn't keep pointing to the same memory space.
    Last edited by pimpmypre; 12/09/2009 at 12:29 PM. Reason: saw something
    WOG Dev - WebOS Group http://www.WebOSGroup.com
    PMP Dev - http://www.PimpMyPre.com
    Apps: WOG O.S.K., WOG Card Keeper, WOG Glowstick, WOG Kid Protect, PreLoad, PimpMySounds
  7.    #7  
    Yeah, it is all in the same scene.

    I tried using this.labelText, but when I call the model change, it takes the original value. :-/

    I appreciate all your help, wish this thing would just work. lol
  8. #8  
    Quote Originally Posted by socca1157 View Post
    Yeah, it is all in the same scene.

    I tried using this.labelText, but when I call the model change, it takes the original value. :-/

    I appreciate all your help, wish this thing would just work. lol
    Did you notice the edit? You were missing an "items" in your setting of the text.

    this.feedMenuModel.items = {
    items:[]

    so this.feedMenuModel.items.items[1].label = "new text";

    You're using the items word twice.
    WOG Dev - WebOS Group http://www.WebOSGroup.com
    PMP Dev - http://www.PimpMyPre.com
    Apps: WOG O.S.K., WOG Card Keeper, WOG Glowstick, WOG Kid Protect, PreLoad, PimpMySounds
  9.    #9  
    I had actually tried both, still freezes up the submenu.
  10. #10  
    If you go back to your original model, as shown in the first post, you'll see that both "items" properties are arrays. That's how the book shows the view menu model, so it should be correct. But since there are two arrays involved, getting to the label text involves specifying an index for both "items" arrays:

    this.feedMenuModel.items[0].items[1].label = "New Text";
    this.controller.modelChanged(this.feedMenuModel);

Posting Permissions