Bug 6425 - Motif drop-down inconsistencies
Summary: Motif drop-down inconsistencies
Status: RESOLVED DUPLICATE of bug 193318
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 2.0   Edit
Hardware: PC Linux-Motif
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Grant Gayed CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2001-11-29 10:44 EST by Patrick Dubroy CLA
Modified: 2007-06-20 10:05 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Patrick Dubroy CLA 2001-11-29 10:44:54 EST
public class DropDownTest {
public static void main(String[] argv) {
	Display display = new Display();
	Shell shell = new Shell(display);
	ToolBar toolBar = new ToolBar(shell, SWT.FLAT);
	ToolItem toolItem = new ToolItem(toolBar, SWT.DROP_DOWN);
	toolItem.addListener(SWT.Selection, new Listener() {
		public void handleEvent(Event e) {
			System.out.println("event occurred");	
		}
	});
	toolBar.setBounds(0, 0, 100, 50);
	Combo combo = new Combo(shell, SWT.DROP_DOWN);
	combo.add("foo");
	combo.setBounds(100, 0, 100, 25);
	shell.open();
	while (!shell.isDisposed()) {
		if (!display.readAndDispatch()) display.sleep();	
	}
}
}
--
When this code is run on Windows, the following will happen:
1. If the mouse is pressed over the main part of the button (ie. not the arrow) 
the event is not sent until the button is released, just like a normal button.
2. If the mouse is pressed over the arrow, the event is sent as soon as the 
button is pressed, and before it is released.
This behaviour is consistent with the way combo boxes work on both Windows and 
Motif. ie., items can be selected from the dropdown as [button down] -> [move 
over desired item] -> [release button].

When the same code is run on Motif, the selection is only sent after the button 
is released no matter where the click occurred, on the arrow or on the main 
part of the button. This behaviour is inconsistent with Windows but especially 
with the way drop-down menus work in Motif.
--
Also the combo box displays slightly weird behaviour on Motif: if you click and 
release very quickly, the menu stays up but if you click, hold, and release, 
the menu disappears quickly. This could be a Motif feature though.
Comment 1 Patrick Dubroy CLA 2001-11-29 10:47:19 EST
Clarification: the two paragraphs above refer to the ToolItem, not the Combo. 
Only the two sentences after refer to the Combo.
Comment 2 Patrick Dubroy CLA 2001-12-11 13:24:14 EST
I tried sending the event on MouseDown, but we can get into trouble if this 
results in opening a popup menu (which it usually does). The problem becomes 
visible when some non-trivial amount of time is spent in the selection handler. 
If the quickly clicks on the drop-down button without moving the mouse (ie., 
does not interact with the menu), the ToolItem will receive MouseDown, but 
never seems to get MouseUp. Thus whenever it receives MouseEnter it thinks it 
should be drawn depressed.

It seems that the Motif menu widget grabs the pointer which is why the ToolItem 
never sees it. Not sure what the "correct" behaviour is, however.
Comment 3 Steve Northover CLA 2007-06-20 09:16:06 EDT

*** This bug has been marked as a duplicate of bug 139318 ***
Comment 4 Steve Northover CLA 2007-06-20 10:04:10 EDT
Oops, wrong duplicate.
Comment 5 Steve Northover CLA 2007-06-20 10:05:13 EDT

*** This bug has been marked as a duplicate of bug 193318 ***