incorrect event for ComboBox in samba4's swat.module.ldbbrowse
John Jorgensen
jorgensen.john at gmail.com
Fri Apr 6 05:37:51 GMT 2007
On 4/5/07, Rafal Szczesniak <mimir at samba.org> wrote:
> I'm sorry but I don't really see event "changeSelected" being used
> in ComboBox. Could you point me somewhere to the source code ?
The clearest indicators in the qooxdoo source are in the
sample code showing how to use ComboBox.
In fact, I found the problem because I used ldbbrowse as a model
for some code I wrote, and then only figured out why my
ComboBox event handler wasn't getting called when I looked lines
872 -- 881 of
./webapps/qooxdoo-0.6.5-sdk/frontend/application/showcase/source/class/showcase/Application.js:
var select = new qx.ui.form.ComboBox();
.
.
.
select.addEventListener("changeSelected", function(e) {
var locale = e.getData().getLabel();
qx.locale.Manager.getInstance().setLocale(locale);
});
There are other such examples at
./webapps/qooxdoo-0.6.5-sdk/frontend/application/sample/source/html/test/ComboBox_1.html:81:
./webapps/qooxdoo-0.6.5-sdk/frontend/application/sample/source/html/test/ComboBox_2.html:82:
./webapps/qooxdoo-0.6.5-sdk/frontend/application/sample/source/html/test/ComboBox_3.html:90:
./webapps/qooxdoo-0.6.5-sdk/frontend/application/sample/source/html/example/ComboBox_1.html:80:
It's hard to pinpoint where the event is raised because of the
way that qooxdoo generates events to reflect property changes. I
_think_ that "changeSelected" is defined by the combination of
line 164 in qx/ui/form/ComboBox.js:
qx.OO.addProperty({ name: "selected", type: "object", instance :
"qx.ui.form.ListItem" });
with some of the code in qx.OO.createProperty() in qx/OO.js:
var changeKey = "change" + p.method;
.
.
.
// Create Event
if (this.hasEventListeners && this.hasEventListeners(changeKey))
{
try
{
this.createDispatchDataEvent(changeKey, newValue);
}
catch(ex)
{
throw new Error("Property " + p.name + " modified: Failed to
dispatch change event: " + ex);
}
}
> If you tested your change with default configuration it could have worked,
> because at the moment combo box itself does not dispatch "changeSelection"
> event as there's only one element on the list (which makes impossible
> selecting something else).
Actually, I think that the existence of a single item in the database
list is the only reason that nobody else has noticed the problem
before. I only noticed it because I cut and pasted some of
ldbbrowse/Gui.js, and was surprised that my event handler never got
called. I thinik if you try to add a second item to the list in a test
copy of ldbbrowse, you'll find that ldbbrowse's event handler isn't
called either.
More information about the samba-technical
mailing list