2009/3/7 Petr Kobalíček <[email protected]>

> Hi Derrell,
>
> thanks for your post. I'm using quite similar way except in dblclick
> handler. What's happen if I double click to empty area (not list item
> in list) and where e.getTarget() will point ? (I think to list
> itself).
>
> Correct way for me is something like this:
>
> list.addListener("dblclick", function(e)
> {
>   if (!(e.getTarget() instanceof qx.ui.form.ListItem)) return;
>
>  // ... now e.getTarget() is list item ...
>  // ... my code ...
> });
>
> Is this correct or there is better solution?
>
> That works. Here's another option:

/*
#require(qx.log.appender.Native)
#require(qx.log.appender.Console)
*/

qx.Class.define("custom.Application",
{
  extend : qx.application.Standalone,

  members :
  {
    main : function()
    {
      this.base(arguments);

      this.list = new qx.ui.form.List();
      this.addItem("Hello");
      this.addItem("world!");
      this.addItem("Is");
      this.addItem("there");
      this.addItem("anybody");
      this.addItem("out");
      this.addItem("there?");
      this.getRoot().add(this.list);
    },

    addItem : function(label)
    {
      var item = new qx.ui.form.ListItem(label);
      item.addListener("dblclick",
                       function(e)
                       {
                         alert("Double click on '" +
                               e.getTarget().getLabel() +
                               "'");
                       });
      this.list.add(item);
    }
  }
});

Derrell
------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to