details: https://code.openbravo.com/erp/devel/pi/rev/df0fc02d0865 changeset: 13257:df0fc02d0865 user: Martin Taal <martin.taal <at> openbravo.com> date: Sun Jul 24 05:55:51 2011 +0200 summary: Related to issue 18072 Focus handling in form and grid editing needs to be cleaned up, results in unpredictable behavior Solve this: open a form, click on a combo (not the first one), select something from the combo, the focus is moved to the first field instead of the field after the combo
details: https://code.openbravo.com/erp/devel/pi/rev/da2bcbd5acc9 changeset: 13258:da2bcbd5acc9 user: Martin Taal <martin.taal <at> openbravo.com> date: Sun Jul 24 05:57:27 2011 +0200 summary: Fixes issue 18073 Reference field in Column tab (of table/column window) behaves strangely when filtering Issue was caused by the fact that each keypress resulted in a change event, causing a redraw of the form details: https://code.openbravo.com/erp/devel/pi/rev/e36538c24d11 changeset: 13259:e36538c24d11 user: Martin Taal <martin.taal <at> openbravo.com> date: Sun Jul 24 05:58:59 2011 +0200 summary: Fixes issue 18074 Clicking in a form field of inactive view puts the focus in the wrong field Set the last focus item of a view to the newly clicked form item Renamed variable canvas to target, as the content can be a canvas or a formItem (which is not a canvas) diffstat: modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-list.js | 5 +- modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form.js | 5 +- modules/org.openbravo.client.application/web/org.openbravo.client.application/js/utilities/ob-eventhandler.js | 58 ++++++--- 3 files changed, 45 insertions(+), 23 deletions(-) diffs (145 lines): diff -r de806a497fba -r e36538c24d11 modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-list.js --- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-list.js Sat Jul 23 16:34:13 2011 +0200 +++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-list.js Sun Jul 24 05:58:59 2011 +0200 @@ -34,8 +34,9 @@ // NOTE: Setting this property to false fixes the issue when using the mouse to pick a value // FIXME: Sometimes the field label gets a red color (a blink) - // addUnknownValues: false, - + addUnknownValues: false, + changeOnKeyPress: false, + selectOnFocus: true, moveFocusOnPickValue: true, diff -r de806a497fba -r e36538c24d11 modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form.js --- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form.js Sat Jul 23 16:34:13 2011 +0200 +++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form.js Sun Jul 24 05:58:59 2011 +0200 @@ -344,13 +344,15 @@ return; } - if (this.forceFocusedField) { + if (!startItem && this.forceFocusedField) { item = this.getItem(this.forceFocusedField); delete this.forceFocusedField; if(item && item.isFocusable(true)) { this.setFocusItem(item); return; } + } else { + delete this.forceFocusedField; } if (!startItem && this.firstFocusedField) { @@ -1442,7 +1444,6 @@ delete this.storedFocusItem; delete this.storedSelectionRange; } - }; isc.OBViewForm.addProperties(OB.ViewFormProperties); diff -r de806a497fba -r e36538c24d11 modules/org.openbravo.client.application/web/org.openbravo.client.application/js/utilities/ob-eventhandler.js --- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/utilities/ob-eventhandler.js Sat Jul 23 16:34:13 2011 +0200 +++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/utilities/ob-eventhandler.js Sun Jul 24 05:58:59 2011 +0200 @@ -36,10 +36,28 @@ EventHandler.prototype = { mouseDown: function (canvas) { - return this.processEvent(canvas); + var lastEvent = isc.EventHandler.lastEvent, + checkName = lastEvent.nativeTarget ? lastEvent.nativeTarget.name : null, + index = checkName ? checkName.indexOf('_') : -1; + // this code assumes that there is a name attribute on the html element + // which points to the formitem + // happens with compount formitems, such as date + // in that case the formitem name consists of the fieldname followed + // by the + if (index !== -1) { + checkName = checkName.substring(0, index); + } + + // handle a click on a formitem + if (isc.isA.DynamicForm(canvas) && checkName) { + return this.processEvent(canvas.getField(checkName)); + } else { + return this.processEvent(canvas); + } }, - processEvent: function(canvas) { + // at this point target can be a canvas or a formitem + processEvent: function(target) { var onClickTarget = null, lastEvent = isc.EventHandler.lastEvent; // handle a special case: @@ -50,48 +68,50 @@ onClickTarget = lastEvent.DOMevent.target; } - if (!canvas) { + if (!target) { return true; } - if (canvas.pane && canvas.pane.setAsActiveView) { - canvas.pane.setAsActiveView(); + if (target.pane && target.pane.setAsActiveView) { + target.pane.setAsActiveView(); return true; } // when clicking in the tabbar - if (canvas.tabSet && canvas.tabSet.getSelectedTab() && canvas.tabSet.getSelectedTab().pane - && canvas.tabSet.getSelectedTab().pane.setAsActiveView) { - canvas.tabSet.getSelectedTab().pane.setAsActiveView(); + if (target.tabSet && target.tabSet.getSelectedTab() && target.tabSet.getSelectedTab().pane + && target.tabSet.getSelectedTab().pane.setAsActiveView) { + target.tabSet.getSelectedTab().pane.setAsActiveView(); return true; } do { - if (canvas.view && canvas.view.setAsActiveView) { + if (target.view && target.view.setAsActiveView) { // don't do this if already activec - if (canvas.view.isActiveView()) { + if (target.view.isActiveView()) { onClickTarget = null; } - canvas.view.setAsActiveView(); + target.view.setAsActiveView(); if (onClickTarget) { onClickTarget.onclick(); } return true; } - if (isc.FormItem.isA(canvas)) { - var view = OB.Utilities.determineViewOfFormItem(item); + // a direct click in a form item + if (isc.isA.FormItem(target)) { + var view = OB.Utilities.determineViewOfFormItem(target); if (view && view.setAsActiveView) { + view.lastFocusedItem = target; view.setAsActiveView(); return true; } } - if (canvas.mouseDownCancelParentPropagation) { // Added to be able to scroll the toolbar without focusing top level view - canvas = null; - } else if (!canvas.parentElement && canvas.grid) { - canvas = canvas.grid; + if (target.mouseDownCancelParentPropagation) { // Added to be able to scroll the toolbar without focusing top level view + target = null; + } else if (!target.parentElement && target.grid) { + target = target.grid; } else { - canvas = canvas.parentElement; + target = target.parentElement; } - } while (canvas); + } while (target); return true; } }; ------------------------------------------------------------------------------ Magic Quadrant for Content-Aware Data Loss Prevention Research study explores the data loss prevention market. Includes in-depth analysis on the changes within the DLP market, and the criteria used to evaluate the strengths and weaknesses of these DLP solutions. http://www.accelacomm.com/jaw/sfnl/114/51385063/ _______________________________________________ Openbravo-commits mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openbravo-commits
