Hi,
this should be possible by implementing your own form renderer. Take a
look at the _createLabel() method in qx.ui.form.renderer.Single, for
example: The first argument is whatever you defined as the second
argument for qx.ui.form.Form.add(), so in your own renderer inheriting
from the "Single" renderer, you could change that to a map containing
the information needed to create an Atom with a ToolTip and return that
instead of the regular label.
There are two caveats when using this approach, however:
1) You'll have to specify a name (String) for your field in
qx.ui.form.Form.add() - if you don't, the form will try to treat the
label argument as text to determine the field's name and fail.
2) By using an Atom instead of a qx.ui.basic.Label, you lose the "buddy"
property that allows focusing the form widget by clicking on the label.
(And there might be other problems - I'm not intimately familiar with
the Form classes). To get around this, you could look into writing your
own label that looks like an Atom, or you could "fake" an Atom by
creating a container with an icon and a regular label, which is what I
tried.
Here are the relevant parts of my code:
// Creating the form
var f1 = new qx.ui.form.Form();
var labelOpts = {
labelText : "Foo",
tooltipText : "Bar",
iconUrl : "mltest/test.png"
};
f1.add(new qx.ui.form.TextField(), labelOpts, null, "foo");
var renderer = new mltest.MyFormRenderer(f1);
// mltest.MyFormRenderer:
_createLabel : function(labelOpts, item) {
var required = "";
if (item.getRequired()) {
required = " <span style='color:red'>*</span> ";
}
var tooltip = new qx.ui.tooltip.ToolTip(labelOpts.tooltipText);
var icon = new qx.ui.basic.Image(labelOpts.iconUrl);
icon.setToolTip(tooltip);
var label = new qx.ui.basic.Label(labelOpts.labelText + required + "
:");
label.setRich(true);
label.setToolTip(tooltip);
var container = new qx.ui.container.Composite(new qx.ui.layout.HBox());
container.add(icon);
container.add(label);
container.setBuddy = function(item) {
label.setBuddy(item);
};
return container;
}
Regards,
Daniel
phill54 schrieb:
> Hi,
>
> I'm currently doing some prototype forms for a web project that we're about
> to startup and we'd like make use of qooxdoo.
>
> for the moment I don't see any possibility to label a form with an atom
> (label/image, incl ToolTip etc.) as the only way to add a Form Element to a
> form is the add-function - ?!
>
> Is there a way of doing this?
>
> Thanks for the help & best regards!
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel