> I would think that you are going to have to give each one a unique ID
> in order for TextComplete to find the object. This was the case when 
> we were trying it with another toolkit, we have not yet tried it with
> qooxdoo. Adding a unique ID is just some additional code that in our
> case seems to be necessary.

I've done some work on this.  I've added a property called "ID" to qxWidget, 
and then when it is changed I set the HTML attribute for the element to the 
value of the ID. 

Using HTML properties to add the ID (via qxWidget.setHtmlProperty) works in IE 
but not in FF. Setting of HTML attributes (via qxWidget.setHtmlAttribute) is 
broken in 0.5.2 but when this is fixed it all works. A patch is attached which 
fixes setHtmlAttribute in trunk - this was fixed a week ago in the namespaces 
branch with revision 3208.

You can get around the bug by rewriting a function in qxWidgets in your own 
code. That saves having to patch and rebuild qx.

Here is all my code, which I've tested by inserting into Atom_1.html:

  <script type="text/javascript">
QxWidget.addProperty({ name : "ID", type : QxConst.TYPEOF_STRING });

QxWidget.prototype._modifyID = function(propValue, propOldValue, propData)
   {
   if (propValue)
      {
      this.setHtmlAttribute("ID", propValue);
      }
   else
      {
      this.removeHtmlAttribute("ID");
      };

  return true;
};
//
// Rewritten _applyHtmlAttributes to fix bug in 0.5.2 qooxdoo
//
QxWidget.prototype._applyHtmlAttributes = function(vElement)
{
  var vAttributes = this._htmlAttributes;

  if (vAttributes)
  {
    var propName;

    for (propName in vAttributes) {
      vElement.setAttribute(propName, vAttributes[propName]); // fix
    };
  };
};

  window.application.main = function()
  {
    var d = this.getClientWindow().getClientDocument();

    // test no1
    var nl1 = new QxAtom("Test #1", "icons/16/reload.png", 16, 16);
    nl1.setTop(48);
    nl1.setLeft(20);
    nl1.setBorder(QxBorder.presets.black);
    nl1.setBackgroundColor(new QxColor("white"));
    nl1.setPadding(4);
    nl1.setID("nl1");                  // set HTML ID for this element
    d.add(nl1);
  };
  </script>

Hugh

Attachment: html_attribute.patch
Description: Binary data

Reply via email to