Hello,
We are using a ListGrid backed by a DS to display some data, which at a given point is edited by a user. All of the columns have custom editors which extend FormItem directly except one of them which extends CanvasItem.
When we go into edit mode of a grid line, all editors are behaving as they should in regards to the click mask which is set up by the listgrid. Clicking outside of the grid disables the edit mode. However, once we touch the editor which extends from CanvasItem, this behavior is broken - the grid remains into edit mode when we click outside the grid.
Is there any hint you can provide that could fix this behavior? Are we missing some code to make this working - I realize that the use of CanvasItem can complicate things.
We use the CanvasItem to build a customized checkbox (provides 3-state functionality and alternate label orientation when used outside of grids). This checkbox is built by custom StatefulCanvas implementation which contains an instance of a Img widget.
As far as I can tell, this behavior is caused by the fact that hovering over the 'check-box' is seen as a 'mouse out' event of the grid(row) which causes the click mask to be removed? When one hovers over the other (regular) grid cells this does not happen (no logging in dev console about mouse out).
Here's some sample code to illustrate things.
The checkbox implementation.
The init handler in the editor which sets the components up.
Many thanks for your insights.
We are on SC_SNAPSHOT-2011-08-25/Pro Deployment (built 2011-08-25) and testing with FF 6.
We are using a ListGrid backed by a DS to display some data, which at a given point is edited by a user. All of the columns have custom editors which extend FormItem directly except one of them which extends CanvasItem.
When we go into edit mode of a grid line, all editors are behaving as they should in regards to the click mask which is set up by the listgrid. Clicking outside of the grid disables the edit mode. However, once we touch the editor which extends from CanvasItem, this behavior is broken - the grid remains into edit mode when we click outside the grid.
Is there any hint you can provide that could fix this behavior? Are we missing some code to make this working - I realize that the use of CanvasItem can complicate things.
We use the CanvasItem to build a customized checkbox (provides 3-state functionality and alternate label orientation when used outside of grids). This checkbox is built by custom StatefulCanvas implementation which contains an instance of a Img widget.
As far as I can tell, this behavior is caused by the fact that hovering over the 'check-box' is seen as a 'mouse out' event of the grid(row) which causes the click mask to be removed? When one hovers over the other (regular) grid cells this does not happen (no logging in dev console about mouse out).
Here's some sample code to illustrate things.
The checkbox implementation.
Code:
private class ThreeStateImg extends StatefulCanvas { private HLayout layout; private Img img; private Label label; public ThreeStateImg(final CanvasItem source, final MyCheckboxEditor editor) {
Code:
public class MyCheckboxEditor extends CanvasItem { public MyCheckboxEditor(boolean isReadOnly, boolean isThreeState, MyValueType theValueType) { super(); //http://forums.smartclient.com/showthread.php?t=18110 this.setInitHandler(new FormItemInitHandler() { public void onInit(FormItem item) { CanvasItem canvasItem = new CanvasItem(item.getJsObj()); // If a value is added on MyCheckboxItem, before the item was drawn, // fetch this value and perform a setValue on the canvasItem. // 'newValue' will be null if using a proper datasource (ok) ThreeStateImg img = new ThreeStateImg(canvasItem, MyCheckboxEditor.this); img.setCanFocus(true); // Need to set this to be able to get focus while tabbing img.setCanHover(true); img.setDrawState(MyCheckboxItem.getValueWhileNotCreated(item), false); canvasItem.setCanvas(img); } });
Many thanks for your insights.
We are on SC_SNAPSHOT-2011-08-25/Pro Deployment (built 2011-08-25) and testing with FF 6.
Comment