Hi Martin,
here my example playground example:
http://demo.qooxdoo.org/current/playground/#%7B%22code%22%3A%20%22var%2520selectBox%2520%253D%2520new%2520qx.ui.form.SelectBox%28%29%253B%250Avar%2520listItems%2520%253D%2520%255B%255D%253B%250A%250Afor%2520%28var%2520i%2520%253D%2520100%253B%2520i%2520%253C%2520120%253B%2520i%252B%252B%29%250A%257B%250A%2520%2520var%2520tempItem%2520%253D%2520new%2520qx.ui.form.ListItem%28%2522number%2520%2522%2520%252B%2520%28i%252B1%29%29%253B%250A%2520%2520selectBox.add%28tempItem%29%253B%250A%2520%2520listItems%255Bi%252B1%255D%2520%253D%2520tempItem%253B%250A%257D%250A%250Avar%2520button1%2520%253D%2520new%2520qx.ui.form.Button%28%2522Get%2520value%2522%29%253B%250Abutton1.addListener%28%2522execute%2522%252C%2520function%28e%29%2520%257B%250A%2520%2520alert%28%2522Get%2520value%2520from%2520--%253E%2520%2522%2520%252B%2520selectBox.getSelection%28%29%255B0%255D.getLabel%28%29%2520%252B%2520%2522%2520%253C--%2522%29%253B%250A%257D%29%253B%250A%2520%2520%2520%2520%2520%2520%250Avar%2520button2%2520%253D%2520new%2520qx.ui.form.Button%28%2522Set%2520value%2520%27number%2520109%27%2522%29%253B%250Abutton2.addListener%28%2522execute%2522%252C%2520function%28e%29%2520%257B%250A%2520%2520selectBox.setSelection%28%255BlistItems%255B109%255D%255D%29%253B%250A%257D%29%253B%250A%250Avar%2520doc%2520%253D%2520this.getRoot%28%29%253B%250Adoc.add%28selectBox%252C%2520%257Bleft%253A%252010%252C%2520top%253A%252050%257D%29%253B%250Adoc.add%28button1%252C%2520%257Bleft%253A%2520250%252C%2520top%253A%252050%257D%29%253B%250Adoc.add%28button2%252C%2520%257Bleft%253A%2520500%252C%2520top%253A%252050%257D%29%253B%250A%250A%22%7D
I have saved the references form the ListItem instances in an array to
access them.
Cheers,
Chris
Am 15.01.2010 11:18, schrieb Martin_GER:
> hi,
> what is the easiest way to get/set a value from/to a selectbox.
> I have create a simple example. I want the first button to get the selected
> value and with
> the second button to set the value 'number 109'.
> I use qooxdoo 1.0.
>
> Can someone help me?
>
> Thanks!
>
> Application.js:
> /*
> #asset(testselect/*)
> */
>
> qx.Class.define("testselect.Application",
> {
> extend : qx.application.Standalone,
>
> construct : function()
> {
> this.base(arguments);
> this.widgets = new Array();
> },
>
> members :
> {
> widgets : null,
> main : function()
> {
> this.base(arguments);
>
> var selectBox = new qx.ui.form.SelectBox();
> for (var i = 100; i< 120; i++)
> {
> var tempItem = new qx.ui.form.ListItem("number
> " + (i+1));
> selectBox.add(tempItem);
> }
> this.widgets["TestSelectBox"] = selectBox;
>
> var button1 = new qx.ui.form.Button("Get value");
> button1.addListener("execute", function(e) {
> alert("Get value from -->
> this.widgets['TestSelectBox']<--");
> });
>
> var button2 = new qx.ui.form.Button("Set value 'number
> 109'");
> button2.addListener("execute", function(e) {
> alert("Set value 'number 109' to -->
> this.widgets['TestSelectBox']
> <--");
> });
>
> var doc = this.getRoot();
> doc.add(this.widgets["TestSelectBox"], {left: 10, top:
> 50});
> doc.add(button1, {left: 250, top: 50});
> doc.add(button2, {left: 500, top: 50});
> }
> }
> });
>
>
--
Christian Schmidt
Software Entwickler
1&1 Internet AG - Web Technologies
Ernst-Frey-Straße 9 · DE-76135 Karlsruhe
[email protected]
Amtsgericht Montabaur / HRB 6484
Vorstände: Henning Ahlert, Ralph Dommermuth, Matthias Ehrlich, Thomas
Gottschlich, Robert Hoffmann, Markus Huhn, Hans-Henning Kettler, Dr. Oliver
Mauss, Jan Oetjen
Aufsichtsratsvorsitzender: Michael Scheeren
------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel