Double clicking on Tree items under Mac and Linux [message #548504] |
Thu, 22 July 2010 08:12 |
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
|
|
|
Powered by
FUDForum. Page generated in 0.02639 seconds