|
Re: No SelectionEvent when right-clicking Tree [message #462736 is a reply to message #462709] |
Tue, 18 October 2005 15:06 |
Grant Gayed Messages: 2150 Registered: July 2009 |
Senior Member |
|
|
Hi Cam,
I've verified that this is working at the SWT level (snippet below) and also
in a simple jface example. I don't know if jface ever chooses to not fire
right-click selection events if there's a context menu to be shown. As an
experiment, see if not having a context menu makes a difference.
In the absence of more definitive follow-ups you should ask this on the
eclipse.platform newsgroup, since that is where the jface component lives.
It may also be helpful if you are able to reduce your code to a small
snippet that demonstrates the problem.
public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
shell.setBounds(10,10,400,200);
Tree tree = new Tree(shell, SWT.NONE);
tree.setBounds(10,10,300,100);
new TreeItem(tree, SWT.NONE).setText("item 0");
new TreeItem(tree, SWT.NONE).setText("item 1");
new TreeItem(tree, SWT.NONE).setText("item 2");
Menu menu = new Menu(shell, SWT.POP_UP);
new MenuItem(menu, SWT.NONE).setText("menu item 0");
tree.setMenu(menu);
tree.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event event) {
System.out.println("selected: " + event.item);
}
});
shell.open();
while(!shell.isDisposed()) {
if(!display.readAndDispatch()) display.sleep();
}
display.dispose();
}
Grant
"Cameron Bateman" <cbateman@rim.com> wrote in message
news:c96f9f8bb46802aed4afdef24fbd4e04$1@www.eclipse.org...
> I have actions sub-classing BaseSelectionListenerAction attached to the
> context-menu for a TreeViewer. They update their selection fine when I
> left-mouse click on a TreeItem. However, if I select an item by
> right-mouse clicking (and thus open the context menu as part of the same
> step), no selection event seems to fire (at least it doesn't reach the
> action's selection listener). I have seen similar bugs to this logged in
> Bugzilla but all of the ones that are similar are marked fixed pre-dating
> Eclipse 3.0.
>
> My platform is Windows XP.
>
> Is there a known issue/work-around for this?
>
>
> --Cam
>
>
|
|
|
|
Re: No SelectionEvent when right-clicking Tree [message #462793 is a reply to message #462748] |
Wed, 19 October 2005 14:45 |
Grant Gayed Messages: 2150 Registered: July 2009 |
Senior Member |
|
|
ok, I see. This is the behaviour across the platforms. Though I don't know
the history behind this definition of Selection, it seems to be by design,
so I don't think that this is a bug. Listening for SWT.MouseDown in
addition to SWT.Selection should allow you to handle left- and right-clicks
the same for selected items.
Grant
"Cameron Bateman" <cbateman@rim.com> wrote in message
news:d72685986299e003b95a884bcf6ee726$1@www.eclipse.org...
> > I've verified that this is working at the SWT level (snippet below) and
also
> > in a simple jface example. I don't know if jface ever chooses to not
fire
> > right-click selection events if there's a context menu to be shown. As
an
> > experiment, see if not having a context menu makes a difference.
>
> Hi Grant. Thanks for your reply.
>
> In fact, the problem I'm having *is* manifesting in your example, it's
> just I didn't describe it specifically enough. To reproduce try this:
>
> 1) Select any tree item with the left mouse -- selection event fires.
> 2) Now click the *same, selected* item again with your right mouse button
> -- selection event *does not fire*. However,
> 3) If you click this already selected item again with the left mouse the
> selection event does fire, so unless I'm misunderstanding the semantics of
> the event there is inconsistent behaviour between a left and right mouse
> event on an *already selected* tree item -- at least on Windows.
>
>
> --Cam
>
|
|
|
|
|
Re: No SelectionEvent when right-clicking Tree [message #462800 is a reply to message #462748] |
Wed, 19 October 2005 15:21 |
Eclipse User |
|
|
|
Originally posted by: richkulp.us.NO_SPAM.ibm.com
The only thing I can think of is on some systems right click DOES NOT do
selection. Right click means bring up popup menu only, not select and
bring up popup menu.
Cameron Bateman wrote:
>> I've verified that this is working at the SWT level (snippet below)
>> and also
>> in a simple jface example. I don't know if jface ever chooses to not
>> fire
>> right-click selection events if there's a context menu to be shown.
>> As an
>> experiment, see if not having a context menu makes a difference.
>
>
> Hi Grant. Thanks for your reply.
>
> In fact, the problem I'm having *is* manifesting in your example, it's
> just I didn't describe it specifically enough. To reproduce try this:
>
> 1) Select any tree item with the left mouse -- selection event fires.
> 2) Now click the *same, selected* item again with your right mouse
> button -- selection event *does not fire*. However,
> 3) If you click this already selected item again with the left mouse the
> selection event does fire, so unless I'm misunderstanding the semantics
> of the event there is inconsistent behaviour between a left and right
> mouse event on an *already selected* tree item -- at least on Windows.
>
>
> --Cam
>
--
Thanks,
Rich Kulp
|
|
|
Powered by
FUDForum. Page generated in 0.03018 seconds