Thanks mate, that does work, but I had to be able to set it using the initalVal 
parameter I passed to the function, with out using a loop.

easily done with if-else with two items but some of them have many items, and 
are dynamic.

This is what I came up with and it works:

field.setSelected(field.getList().getChildren()[initialVal]);

Cheers
Aaron
  ----- Original Message ----- 
  From: Jonathan Viney 
  To: qooxdoo Development 
  Sent: Wednesday, November 22, 2006 3:46 PM
  Subject: Re: [qooxdoo-devel] Setting Combobox Default ListItem


  field.setSelected(item_no);

  Just a guess....

  -Jonathan.


  On 11/22/06, Aaron Cooper <[EMAIL PROTECTED] > wrote:
    Hi Guys,

    Spent a good 3 hours trying to do this simple task, and can't find the way 
of doing it in the API or Demos.

    Take this simple Yes/No Combobox class that I have made:

    function ftmDataEntryYesNo (name, xPos, initialVal) {
     var field = new qx.ui.form.ComboBox();
     field.setCssClassName("ftm-text-fields");
     field.setTop(xPos);
     field.setWidth(75);
     field.tagName = name;
     
     var item_no = new qx.ui.form.ListItem("No");
     item_no.setValue(0);
     
     var item_yes = new qx.ui.form.ListItem("Yes");
     item_yes.setValue(1);
     
     field.add(item_no, item_yes);
     
     //Set the initial value
     field.setSelected(field.getList().item_no);
     
     return field;
    }

    What is wrong there? I know about field.getList().getLastChild(), the above 
code came from a demo example using it. But how do I select a specific child?

    Cheers
    Aaron

    -------------------------------------------------------------------------
    Take Surveys. Earn Cash. Influence the Future of IT
    Join SourceForge.net's Techsay panel and you'll get the chance to share your
    opinions on IT & business topics through brief surveys - and earn cash 
    http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV 

    _______________________________________________
    qooxdoo-devel mailing list
    [email protected] 
    https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel







------------------------------------------------------------------------------


  -------------------------------------------------------------------------
  Take Surveys. Earn Cash. Influence the Future of IT
  Join SourceForge.net's Techsay panel and you'll get the chance to share your
  opinions on IT & business topics through brief surveys - and earn cash
  http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV


------------------------------------------------------------------------------


  _______________________________________________
  qooxdoo-devel mailing list
  [email protected]
  https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to