put focus on previous field
 will cycle by default, unless navigation policy not :CYCLICAL
 in which case returns :NO_PREV_FIELD.
 @return [nil, :NO_PREV_FIELD] nil if cyclical and it finds a field
  if not cyclical, and no more fields then :NO_PREV_FIELD
546616
def select_prev_field
      return :UNHANDLED if @widgets.nil? or @widgets.empty?
      #$log.debug "insdie sele prev field :  #{@active_index} WL:#{@widgets.length}" 
      if @active_index.nil?
        @active_index = @widgets.length 
      else
        f = @widgets[@active_index]
        begin
          on_leave f
        rescue => err
         $log.error " Caught EXCEPTION #{err}"
         Ncurses.beep
#         $error_message = "#{err}" # changed 2010  
         $error_message.value = "#{err}"
         return
        end
      end

      f = @widgets[@active_index]
      index = @focusables.index(f)
      if index > 0
        index -= 1
        f = @focusables[index]
        if f
          select_field f
          return
        end
      end
      
      ## added on 2008-12-14 18:27 so we can skip to another form/tab
      # 2009-01-08 12:24 no recursion, can be stack overflows if no focusable field
      if @navigation_policy == :CYCLICAL
        f = @focusables.last
        select_field @widgets.index(f) if f
      end

      return :NO_PREV_FIELD
    end
692545
def previous(self, cli):
        
        if len(self.focus_stack) > 1:
            try:
                return self[self.focus_stack[-2]]
            except KeyError:
                pass
345413
def leave_current_component
      begin
        @current_component.on_leave
      rescue FieldValidationException => fve
        alert fve.to_s
      end
      # NOTE this is required, since repaint will just not happen otherwise
      # Some components are erroneously repainting all, after setting this to true so it is 
      # working there. 
      @current_component.repaint_required true
      $log.debug " after on_leave STACKFLOW XXX #{@current_component.focussed}   #{@current_component.name}"
      @current_component.repaint
    end
594442
def cycle_focus(self):
        
        windows = self.windows()
        new_index = (windows.index(self.active_window) + 1) % len(windows)
        self.active_window = windows[new_index]
570960
def has_changed(self, field):
        """"""
        if field in self.fields:
            # deferred fields haven't changed
            if field in self.deferred_fields and field not in self.instance.__dict__:
                return False
            return self.previous(field) != self.get_field_value(field)
        else:
            raise FieldError('field "%s" not tracked' % field)
766870
public function setPreferNone()
    {
        //====================================================================//
        // Safety Checks ==> Verify a new Field Exists
        if (empty($this->new)) {
            Splash::log()->err("ErrFieldsNoNew");
        } else {
            //====================================================================//
            // Update New Field structure
            $this->new->syncmode = self::MODE_NONE;
        }

        return $this;
    }
255103
def focus_prev(self):
        """"""
        mid = self.get_selected_mid()
        localroot = self._sanitize_position((mid,))
        if localroot == self.get_focus()[1]:
            newpos = self._tree.prev_position(mid)
            if newpos is not None:
                newpos = self._sanitize_position((newpos,))
        else:
            newpos = localroot
        if newpos is not None:
            self.body.set_focus(newpos)
21211
def record_unchanged?(record_new, record_old)
      # NOTE: Using the dirty state would be great here, but it doesn't keep track of
      # in-place changes.

      allow_indexing?(record_old) == allow_indexing?(record_new) &&
        !@fields.map { |field| record_old.send(field) == record_new.send(field) }.include?(false)
    end
853867
def focusable(*val)
      return @focusable if val.empty?
      oldv = @focusable
      @focusable = val[0]

      return self if oldv.nil? || @_object_created.nil?
      # once the form has been painted then any changes will trigger update of focusables.
      @form.update_focusables if @form
      # actually i should only set the forms focusable_modified flag rather than call this. FIXME
      self
    end
510519
function() {

        var activeElement = this.__activeElement;
        var now = getActiveElement();
        var isBlur = arguments[0];
        var node = this.node;

        if (isBlur !== false && node.contains(now)) {
            this.__focus(activeElement);
        }

        this.__autofocus = false;
        removeClass(node, this.__name('focus'));

        return this;
    }
1106747
function ( direction ) {
			var current = F.current;

			if (current) {
				if (!isString(direction)) {
					direction = current.direction.prev;
				}

				F.jumpto(current.index - 1, direction, 'prev');
			}
		}
720753
def is_cyclic(head):
    
    if not head:
        return False
    runner = head
    walker = head
    while runner.next and runner.next.next:
        runner = runner.next.next
        walker = walker.next
        if runner == walker:
            return True
    return False
421620
public boolean onMove(int nIDMoveCommand)
    {
        boolean flag = super.onMove(nIDMoveCommand);
        this.selectField(null, DBConstants.SELECT_FIRST_FIELD);
        return flag;
    }
1169644
public boolean skipField(FieldInfo field)
    {
        boolean bSkipField = true;
        if ((m_iFieldsTypes & DATA_TYPE_MASK) == ALL_FIELDS)
            bSkipField = false;     // Don't skip any
        if ((m_iFieldsTypes & DATA_TYPE_MASK) == SELECTED_FIELDS)
            if (field.isSelected())
                bSkipField = false;     // Don't skip selected
        if ((m_iFieldsTypes & DATA_TYPE_MASK) == PHYSICAL_FIELDS)
            if (!field.isVirtual())
                bSkipField = false;     // Don't skip non-virtuals (Skip virtuals)
        if ((m_iFieldsTypes & DATA_TYPE_MASK) == DATA_FIELDS)  // SELECTED_FIELDS | PHYSICAL_FIELDS
            if (field.isSelected())
                if (!field.isVirtual())
                    bSkipField = false;     // Don't skip selected (Skip virtuals)
        return bSkipField;
    }
932229
function prev() {
    var loop = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;

    var index = this.index - 1;

    if (index < 0) {
      index = loop ? this.length - 1 : 0;
    }

    this.view(index);
    return this;
  }
629673
function( cb ){
              if( ! self.positionField ){
                cb( null );
              } else {

                // If repositioning is required, do it
                if( self.positionField ){
                  var where, beforeId;
                  if( ! options.position ){
                    where = 'end';
                  } else {
                    where = options.position.where;
                    beforeId = options.position.beforeId;
                  }
                  self.reposition( recordWithLookups, where, beforeId, cb );
                }
              }
            }
400375
def goForward(self):
        
        index = self.indexOf(self.currentEditor())
        if index == -1:
            return
        
        next = self.editorAt(index + 1)
        if next:
            next.setFocus()
            next.setCursorPosition(0)