Hi Daniel,

sorry that my "solution" was not that successful as I hoped, but you're right
this was just something I didn't test...

After a while searching I found one thing that might help you:

If you change the following part in qx.ui.form.ComboBox:
(changes marked by /* ps+- */)
-------------------------
[...]
qx.Proto._modifySelected = function(propValue, propOldValue, propData)
{
  this._fromSelected = true;

  // only do this if we called setSelected seperatly
  // and not from the property "value".
  if (!this._fromValue) {

/* ps+ */
    this.setValue(propValue ? propValue.getLabel().toString() : "");
/* ps- */
  }
[...]
-------------------------

The change is just the ".toString()" call. This will avoid the error when
selecting one element via qx.ui.form.ComboBox.setSelected()

The only thing that does not work is the update of the "current selection"
field.
In my example there is a language-selection box and an "apply" button.
The following code works in that way, that after a language change all items
will be displayed in the new language.
What is not working is the update of the _field element (current selection).
I think we (you ;) ) have to add an event listener for the "changeLocale"
event...
Here's the code: (fragment)

-------------------------
[...]
qx.OO.defineClass("application.winSettings", qx.ui.window.Window, function()
{
  /* ... */
  var combo = this._language = new qx.ui.form.ComboBox;
  combo.add(new qx.ui.form.ListItem(this.tr("English"), "flag_uk.png", "en"));
  combo.add(new qx.ui.form.ListItem(this.tr("German"),  "flag_de.png", "de"));
  combo.add(new qx.ui.form.ListItem(this.tr("Dutch"),   "flag_nl.png", "nl"));
  combo.add(new qx.ui.form.ListItem(this.tr("Italian"), "flag_it.png", "it"));
  combo.setEditable(false);
  combo.setSelected(combo.getList().getFirstChild());
  /* ... */
});

qx.Proto._onApply = function(e)
{
  qx.locale.Manager.getInstance().setLocale(
     this._language.getSelected().getValue()
    );
}
[...]
-------------------------

So initial it looks something like [English][v]

Selection looks like :             [English][v]
                                   [English]
                                   [German ]
                                   [Dutch  ]
                                   [Italian]

...and after selection of "German" and click on the "Apply" button
the Selected (no list popped up) index still says "German" although it should
be "Deutsch".
The list itself _does_ show the translations:
                                   [German        ][v]
                                   [Englisch      ]
                                   [Deutsch       ]
                                   [Niederländisch]
                                   [Italienisch   ]


I'm not sure if my approach might not be the "golden way" of doing it, but
as I don't know any better... ;)
Is here any (other) developer listening in, that could give a good solution to
this? I think this is an issue for the qooxdoo framework.

Best regards
   Peter

>> Peter Schneider <p.schneider <at> tis-gmbh.de> writes:
>>
>> Hi Daniel,
>>
>> I experienced the same with my application here...
>> It is annoying, but not unsolvable:
>>
>> just "force" 'em to String()...
>>
>>   var noItem = new qx.ui.form.ListItem(String(this.tr("No")));
>>
>> ...and you're off.
>>
>> I know it's really weird why other qooxdoo-classes seem to get it right, 
>> while
>> the ListItem doesn't.
>> My first guess is, that it might be due to the optional parameters vIcon and
>> vValue in the constructor of ListItem.
>> Have you tried this one?
>>   var noItem = new qx.ui.form.ListItem(this.tr("No"),null,"no");
>> ...maybe it works, too.
>>
>>   Peter
> 
> Hi Peter,
> thanks for your help.
> 
> Unfortunately it doesn't work quite as it should.
> First of all,
> var noItem = new qx.ui.form.ListItem(this.tr("No"),null,"no");
> results in the same problem.
> 
> I then tried
> var noItem = new qx.ui.form.ListItem(String(this.tr("No")));
> This does work, I don't get the error message anymore, but unfortunately the
> String won't be translated anymore when I change the locale setting.
> 
> Seems like either way I am stuck with a String that can't be translated. :(
> Any more ideas? I wonder if the problem is really within the ListItem itself 
> or
> within the ComboBox widget.
> 
> Regards,
> Daniel Haferkorn
> 
> [...]


-------------------------------------------------------------------------
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