Getting umenu selection from JS


    Apr 11 2013 | 4:09 pm
    Is it possible to get the selected item (number, not text) from umenu, with some kind of getvalueof() routine?
    Also out of interest, is there a way of querying UI objects attributes (those viewed in the inspector?)

    • Apr 11 2013 | 4:46 pm
      Bang into it ?
    • Apr 11 2013 | 4:47 pm
      oops nevermind didn't notice you needed that in JS
    • Apr 11 2013 | 5:08 pm
      You can get attributes using getattr:
      autowatch = 1;
      
      function bang()
      {
      	var menu = this.patcher.getnamed('menu');
      	post(menu.getattr('color'));post();
      }
    • Apr 11 2013 | 5:11 pm
      Seems like you can get the items this way :
      autowatch = 1;
      
      function bang()
      {
      	var menu = this.patcher.getnamed('menu');
      	post(menu.getattr('items'));
      	post();
      }
    • Apr 11 2013 | 5:17 pm
      Hi Nat,
      Turns out I was just being dense, getvalueof() works fine.
      The getattr stuff will come in handy!
      Thanks