Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 291672 - Sash widget breaks and cannot shrink child composite while dragging the sash over any disabled children
Summary: Sash widget breaks and cannot shrink child composite while dragging the sash ...
Status: RESOLVED FIXED
Alias: None
Product: RAP
Classification: RT
Component: RWT (show other bugs)
Version: 1.2   Edit
Hardware: PC Windows 7
: P3 major (vote)
Target Milestone: 1.3 M3   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-10-07 15:38 EDT by Austin Riddle CLA
Modified: 2009-10-09 11:40 EDT (History)
1 user (show)

See Also:


Attachments
Sample project illustrating problem (443.04 KB, application/x-zip-compressed)
2009-10-07 15:42 EDT, Austin Riddle CLA
no flags Details
Suggested solution (845 bytes, patch)
2009-10-08 09:24 EDT, Tim Buschtoens CLA
ruediger.herrmann: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Austin Riddle CLA 2009-10-07 15:38:01 EDT
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/532.0 (KHTML, like Gecko) Chrome/3.0.195.24 Safari/532.0
Build Identifier: 1.2

This applies to ViewPart sashes as well as common use of the Sash widget.
If a child of one of the sash's children (assumedly a composite) is disabled via setEnabled(false), the sash will not be able to shrink its child.  The sash bar then "breaks" by following the mouse cursor even after the button is release from dragging.

Reproducible: Always

Steps to Reproduce:
1.Use provided sample project
2.If not using the sample project,
Set up 2 views side by side.
In the second view use this code:
Composite main = new Composite(parent, SWT.NONE);
	   main.setLayout(new GridLayout(1,true));
	   
	   Composite stretcher = new Composite(main, SWT.BORDER);
	   stretcher.setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,true));
	   stretcher.setLayout(new GridLayout(1,true));
//	   stretcher.setEnabled(false);
	   
	   Label lbl = new Label(stretcher, SWT.NONE);
	   lbl.setText("Drag view sash over this disabled label and the sash WILL NOT work");
	   lbl.setLayoutData(new GridData(SWT.FILL,SWT.FILL, true,false));
	   lbl.setEnabled(false);
	   
	   Text ctrl = new Text(stretcher, SWT.NONE);
	   ctrl.setText("Drag view sash over this text ctrl and the sash WILL work");
	   ctrl.setLayoutData(new GridData(SWT.FILL,SWT.FILL, true,false));
	   
	   ctrl = new Text(stretcher, SWT.NONE);
      ctrl.setText("Drag view sash over this text ctrl and the sash WILL work");
      ctrl.setLayoutData(new GridData(SWT.FILL,SWT.FILL, true,false));
      
      ctrl = new Text(stretcher, SWT.NONE);
      ctrl.setText("Drag view sash over this disabled text ctrl and the sash WILL_NOT work");
      ctrl.setLayoutData(new GridData(SWT.FILL,SWT.FILL, true,true));
      ctrl.setEnabled(false);

3. Run and try to shrink the view by dragging over a disabled control.
Comment 1 Austin Riddle CLA 2009-10-07 15:42:38 EDT
Created attachment 149042 [details]
Sample project illustrating problem

See StretchView.java to find actual code.
Comment 2 Tim Buschtoens CLA 2009-10-08 09:24:14 EDT
Created attachment 149107 [details]
Suggested solution

This is a result of the way qooxdoos EventHandler.js handles "captureWidgets" (i.e. a widget temporarily "stealing" all dom-events). Widgets that are not "enabled" can not receive events. However, it is the original target of the event that is checked (in this case a disabled widget), not the captureWidget. 

This patch modifies EventHandler so the captureWidget (if present) is checked instead. I see no other acceptable solution. Needs to rebuild qx.js/qx-build.js. Also affects other instances where "setCapture" is used (mainly for drag & drop), e.g. "Scale", "Slider".

It is not entirely clear to me whether this was done deliberately or not. If it was, there could be side-effects and an additional parameter would be needed to clearify which behaviour is wanted. However, i could not find any side-effects, and it is hard to imagine any.
Comment 3 Tim Buschtoens CLA 2009-10-08 09:41:17 EDT
Opend qooxdoo bug: http://bugzilla.qooxdoo.org/show_bug.cgi?id=2906
Comment 4 Rüdiger Herrmann CLA 2009-10-09 11:40:20 EDT
Applied patch to CVS HEAD