Community
Participate
Working Groups
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.
Created attachment 149042 [details] Sample project illustrating problem See StretchView.java to find actual code.
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.
Opend qooxdoo bug: http://bugzilla.qooxdoo.org/show_bug.cgi?id=2906
Applied patch to CVS HEAD