Hello Monika,
as i tried your example in the playground, i hav seen it working
clicking out of the widget the first time. But when I click the second
time, the focus is lost. Thats because of qooxdoo's property system.
You registered the listener, which sets the focus back to the
textfield, on changeValue. But as the value did not change the second
time, the focus is lost.
You could use the blur event to get your code working:
this.__percentageTextField.addListener("blur", function() {
if(this.__percentageTextField.getValue() > 100){
this.__percentageTextField.focus();
}
}, this);
But the whole scenario looks like you could need some kind of
validation, right?
Best,
Martin
Am 22.07.2009 um 11:54 schrieb <[email protected]> <[email protected]
>:
Hi Everyone
I am having problem with focus handling in text Field. I want to
check whether the typed value is smaller than 100 and if not put
focus back to that text Field.
Unfortunately this does not seem to work. Please have a look at the
code below. Any idea what I am doing wrong?
qx.Class.define("test.Application",
{
extend : qx.application.Standalone,
members :
{
__percentageInputValueCheck : function(e){
if(e.getData() > 100){
this.__percentageTextField.focus();
}
},
main : function()
{
this.base(arguments);
if (qx.core.Variant.isSet("qx.debug", "on"))
{
qx.log.appender.Native;
qx.log.appender.Console;
}
this.__percentageTextField = new
qx.ui.form.TextField("");
this.__percentageTextField.addListener("changeValue",
this.__percentageInputValueCheck, this);
this.getRoot().add(this.__percentageTextField, {top:
100, left: 150});
this.__applyButton = new
qx.ui.form.Button(this.marktr("OK"));
this.getRoot().add(this.__applyButton, {top: 130,
left: 150});
}
}
});
S pozdravem / Best regards,
Monika Falk, Software Specialist
------------------------------------------------------------------------------
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
------------------------------------------------------------------------------
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel