Bug 65679 - SelectionEvent.stateMask remains 0 even Ctrl (Shift, Alt) were pressed during push operation on button
Summary: SelectionEvent.stateMask remains 0 even Ctrl (Shift, Alt) were pressed during...
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 normal with 8 votes (vote)
Target Milestone: 3.6 M3   Edit
Assignee: Felipe Heidrich CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 55500 80822 82545 (view as bug list)
Depends on:
Blocks: 27996
  Show dependency tree
 
Reported: 2004-06-04 04:31 EDT by Vitaliy CLA
Modified: 2009-11-02 09:45 EST (History)
13 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vitaliy CLA 2004-06-04 04:31:36 EDT
I'm using swt-3.0RC1-win32 version of SWT library.

Sample of my code:

		Display display = new Display ();
		Shell shell = new Shell (display);
		Button ok = new Button (shell, SWT.PUSH);
		ok.addSelectionListener(new SelectionAdapter(){
				public void widgetSelected(SelectionEvent e)
				{
					System.out.println("StateMask:" + 
e.stateMask);
				}
			});
		ok.setText ("Try");
		shell.setLayout (new RowLayout ());
		shell.pack ();
		shell.open ();
		while (!shell.isDisposed ()) {
			if (!display.readAndDispatch ()) display.sleep ();
		}
		display.dispose ();

If push "Try" with pressed CTRL (SHIFT, ALT) stateMask field remains 0 (instead 
of expected SWT.CTRL, SWT.SHIFT, SWT.ALT).
Comment 1 Steve Northover CLA 2004-06-04 09:24:14 EDT
This mask is only set for MenuItems during selection.  We should consider 
filling it in for all controls or providing API in display to query the 
state.  Post 3.0.
Comment 2 Steve Northover CLA 2004-12-21 15:30:48 EST
*** Bug 80822 has been marked as a duplicate of this bug. ***
Comment 3 Laurent CLA 2005-01-03 10:52:20 EST
It will be very useful to fill the stateMask for all controls.
For exemple, for a TableColumn.
It can be useful to select more than one column to sort a TableViewer when Ctrl
is pressed...
Comment 4 Steve Northover CLA 2005-01-11 14:22:13 EST
*** Bug 82545 has been marked as a duplicate of this bug. ***
Comment 5 Laurent CLA 2005-05-09 10:12:23 EDT
I realy need this fix for my applications.

Do you have any clue on where to fix this bug ?
Comment 6 Steve Northover CLA 2005-05-09 14:35:04 EDT
Laurent, we are probably not going to get to this for 3.1.  In which control 
do you need this information?
Comment 7 Laurent CLA 2005-05-09 18:43:05 EDT
(In reply to comment #6)
> Laurent, we are probably not going to get to this for 3.1.  In which control 
> do you need this information?

I need this for the TableColumn. When I select one, I need to know what is the mask.
Comment 8 Stefan Lötscher CLA 2005-07-16 13:33:43 EDT
(In reply to comment #6)

The same bug exists on OS X in 3.1.
It would be very useful for us if we could have the state mask in TableColumns, exactly for the same 
purpose Laurant explained in comment #3. Our RCP applications uses tables heavily and the customers 
expects such a behavior to sort columns.
Comment 9 Anton Zelinka CLA 2005-10-27 13:51:16 EDT
(In reply to comment #8)

Bump.

What is the status/workaround for this issue?  I ran into the same thing when 
trying to implement multiple sort columns.

Cheers.

Comment 10 Steve Northover CLA 2005-10-27 14:02:07 EDT
It's a big job to go and find every selection event on every platform and fill 
in the values.  Also, people who write their own controls would need to fill 
in the values themselves.  Querying the key state on X systems can be 
expensive because it causes a round trip to the server.
Comment 11 Anton Zelinka CLA 2005-10-27 16:46:32 EDT
Steve,

Is SelectionEvent.stateMask only populated for "menu selection events"?  If 
so, it would be helpful if that was mentioned in the SelectionEvent Javadoc 
somewhere (ideally the API would not expose dummy fields; e.g. remove 
stateMask from SelectionEvent and provide a MenuSelectionEvent).

I see two workarounds for this issue (if it is undesirable to provide a 
stateMask for every SelectionEvent)

* Enable TableColumn to receive MouseEvents (which do have a functional 
stateMask).  Some work for this can be found in bug 32322

* Provide a way to query the key state.  How reliable is OS.GetKeyState across 
platforms?  (See also bug 74736 and bug 71538 )

Cheers.
Comment 12 Laurent CLA 2006-04-19 06:03:29 EDT
Bump.

Is there a chance to have the bug fixed for 3.2 ?
At least for the TableColumn ?
Please...
Comment 13 Steve Northover CLA 2006-04-19 09:23:20 EDT
!@#$!@$$!@#$!@!!  I missed this one.  I'm sorry but it won't make it into 3.2.  Ping early in the 3.3 cycle please.
Comment 14 Francis Leboutte CLA 2006-06-28 11:03:48 EDT
Would like the stateMask updated in a TableColumn selection event too.
Thank you.
Comment 15 Laurent CLA 2006-08-25 05:23:00 EDT
up !
for the 3.3 please ;)
Have you some news ?
Comment 16 Laurent CLA 2006-09-21 08:54:46 EDT
No news...
Good news ?
Comment 17 Francis Leboutte CLA 2006-10-04 09:28:48 EDT
Hello again,

Today it would have help me very much to be able to access the statemask in the locationevent of a browser...

It is really something I would like to see in all the controls. Thank you the SWT team to think about this.

Francis
Comment 18 Markus Keller CLA 2007-05-04 08:55:33 EDT
Would also be interesting for ToolItems (e.g. Ctrl+Click on a tool bar button).
Comment 19 Hao Zhang CLA 2007-08-28 10:01:00 EDT
I have to say this feature is useful (if not critical) for lots of applications.. but still not in eclipse 3.3
Comment 20 Markus Keller CLA 2009-02-10 13:15:14 EST
Dup of bug 55500 (or vice versa)?
Comment 21 Felipe Heidrich CLA 2009-10-23 16:03:11 EDT
Fixed in HEAD > 20091023

fixed for win32, gtk, and cocoa all the following:
Button		-- button is activate
CoolItem	-- chevron is activate
TreeColumn	-- column is activate (click on header)
TableColumn	-- column is activate (click on header)
Link		-- a link is activate
MenuItem	-- item is activate
ToolItem	-- item is activate
ToolTip		-- item is activate (clicked on)
TrayItem	-- item is activate (clicked on)

List		-- selected item changes
Table		-- selected item changes
Tree		-- selected item changes
TabFolder	-- selected item changes

Combo		-- selected item in the list changes
DateTime	-- value of a field changes
Sash		-- sash location changes
Scale		-- selection value changes
ScrollBar	-- selection value changes
Slider		-- selection value changes
Spinner		-- selection value changes


DefaultSelection

All activate
Text		-- return on single, click on search icon
DateTime	-- return
Table		-- return or double click
Tree		-- return or double click
List		-- [return or] double click
Combo		-- return
Spinner		-- return
TrayItem	-- double click



---------------------------------------------
I still need to take a look at the custom controls and motif and carbon.
Comment 22 Markus Keller CLA 2009-11-02 09:45:45 EST
*** Bug 55500 has been marked as a duplicate of this bug. ***