Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Double clicking on Tree items under Mac and Linux(When intervals between double clicks are short, DoubleClick event is not fired)
Double clicking on Tree items under Mac and Linux [message #548504] Thu, 22 July 2010 08:12
Albert Pikus is currently offline Albert Pikus
Messages: 70
Registered: October 2009
Member
Hi,

On Windows double click expands/collapses tree items automatically, as long as untyped selection listener is registered (I also have SelectionListener registered on my tree) - in opposite case, double click stops working correctly. So double click is working fine on Windows.

But on Mac and Linux, DoubleClick doesn't work automatically, so I added SWT.MouseDoubleClick listener too when running on Mac/Linux. Although expanding/collapsing of tree items by double clicking works on Mac/Linux, event is not fired if interval between two double clicks is too short - when double clicking very fast, DoubleClick event is not fired.

Here is the code:

if (isMac() || isLinux())
        {
            tree.addListener(SWT.MouseDoubleClick, new Listener()
            {
                public void handleEvent(Event event)
                {
                    Point point = new Point(event.x, event.y);
                    TreeItem item = tree.getItem(point);
                    if (item != null)
                    {
                        if (item.getExpanded())
                        {
                            item.setExpanded(false);                            
                        }
                        else
                        {
                            item.setExpanded(true);
                        }
                    }
                }
            });
        }


I think that this problem can be solved, since the Eclipse Package Explorer doesn't suffer from it - no matter how fast you click on tree items, double click is always fired.

Any ideas would be helpful, best regards,


Albert

[Updated on: Thu, 22 July 2010 09:10]

Report message to a moderator

Previous Topic:Opening Excel using SWT Ole mechanism
Next Topic:Tooltips on disabled components
Goto Forum:
  


Current Time: Thu Oct 23 02:24:53 GMT 2014

Powered by FUDForum. Page generated in 0.11654 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software