returns a widget based on offset, or name (if you gave it a :name)
 e.g. a list was declared and we wish to know the selected_indices
968257
def widget n
      case n
      when Integer
        @form.widgets[n]
      when String, Symbol
        @form.by_name[n] 
      else
        raise "messagebox.widget can't handle #{n.class} "
      end
    end
374721
def selected(self, sel):
        """"""
        ParameterItem.selected(self, sel)

        if self.widget is None:
            return
        if sel and self.param.writable():
            self.showEditor()
        elif self.hideWidget:
            self.hideEditor()
604891
def find_widget(self, name):
        
        result = None
        for column in self._columns:
            for widget in column:
                if widget.name is not None and name == widget.name:
                    result = widget
                    break
        return result
876171
public synchronized Widget measureChild(final int dataIndex, boolean calculateOffset) {
        Log.d(Log.SUBSYSTEM.LAYOUT, TAG, "measureChild dataIndex = %d", dataIndex);

        Widget widget = mContainer.get(dataIndex);
        if (widget != null) {
            synchronized (mMeasuredChildren) {
                mMeasuredChildren.add(dataIndex);
            }
        }
        return widget;
    }
52786
def item_for widget
      each do |e|
        if e.is_a? Item
          if e.widget == widget
            return e
          end
        end
      end
      return nil
    end
780481
def _set(self, name, value):
        ""
        return self.widget(self.widget_element._set(name, value))
1370836
def select_by_widget(self, widget):
        
        for a, li, holder in self._tabs.values():
            if holder.children['content'] == widget:
                self._on_tab_pressed(a, li, holder)
                return
1002228
def variable_index( name )
      has = names.index_of(name)
      return nil unless has
      raise "internal error #{name}:#{has}" if has < 0
      has
    end
747170
def select(self, fixed):
        
        names = [n for n in self.names() if self[n].isfixed == fixed]
        return Variables({n: self[n] for n in names})
1007081
def offset(self, n):
        

        idx = self.index
        if idx is not None:
            sibling = idx + n
            container = self.container
            if 0 <= sibling < len(container):
                return container[sibling]
718212
def on_dialog_confirm(self, widget):
        
        variableName = str(self.dialog.get_field("name").get_value())
        if re.match('(^[a-zA-Z][a-zA-Z0-9_]*)|(^[_][a-zA-Z0-9_]+)', variableName) == None:
            self.errorDialog = gui.GenericDialog("Error", "Please type a valid variable name.", width=350,height=120)
            self.errorDialog.show(self.appInstance)
            return

        if variableName in self.varname_list:
            self.errorDialog = gui.GenericDialog("Error", "The typed variable name is already used. Please specify a new name.", width=350,height=150)
            self.errorDialog.show(self.appInstance)
            return

        param_annotation_dict = ''#self.widgetClass.__init__.__annotations__
        param_values = []
        param_for_constructor = []
        for index in range(0,len(self.widgetClass.__init__._constructor_types)):
            param = self.constructor_parameters_list[index]
            _typ = self.widgetClass.__init__._constructor_types[index]
            if _typ==int:
                param_for_constructor.append(self.dialog.get_field(param).get_value())
                param_values.append(int(self.dialog.get_field(param).get_value()))
            elif _typ==bool:
                param_for_constructor.append(self.dialog.get_field(param).get_value())
                param_values.append(bool(self.dialog.get_field(param).get_value()))
            else:#if _typ==str:
                param_for_constructor.append("""\'%s\'"""%self.dialog.get_field(param).get_value())
                param_values.append(self.dialog.get_field(param).get_value())
            #else:
            #    param_for_constructor.append("""%s"""%self.dialog.get_field(param).get_value())

        print(self.constructor_parameters_list)
        print(param_values)
        #constructor = '%s(%s)'%(self.widgetClass.__name__, ','.join(map(lambda v: str(v), param_values)))
        constructor = '(%s)'%(','.join(map(lambda v: str(v), param_for_constructor)))
        #here we create and decorate the widget
        widget = self.widgetClass(*param_values, **self.kwargs_to_widget)
        widget.attributes.update({'editor_constructor':constructor,
            'editor_varname':variableName,
            'editor_tag_type':'widget',
            'editor_newclass':'True' if self.dialog.get_field("editor_newclass").get_value() else 'False',
            'editor_baseclass':widget.__class__.__name__}) #__class__.__bases__[0].__name__
        #"this.style.cursor='default';this.style['left']=(event.screenX) + 'px'; this.style['top']=(event.screenY) + 'px'; event.preventDefault();return true;"
        #if not 'position' in widget.style:
        #    widget.style['position'] = 'absolute'
        #if not 'display' in widget.style:
        #    widget.style['display'] = 'block'

        for key in self.optional_style_dict:
            widget.style[key] = self.optional_style_dict[key]
        self.optional_style_dict = {}

        self.appInstance.add_widget_to_editor(widget)
185794
def get_widget(self, request):
        
        widget = self.widget
        if isinstance(widget, type):
            widget = widget()
        return widget
280128
def offset(self, offset):
        
        if self._offset != offset:
            self.dirty = True
            self._offset = offset
        return self
149369
function(name) {

		var result = [],
			i = 0;

		for (; i < this._count; i++) {

			if (this._content[i].isWidget && this._content[i].name == name) {

				result.push(this._content[i]);

			}

		}

		return result;

	}
504329
def get_widget(self, request):
        
        return self._update_widget_choices(self.field.formfield(widget=RestrictedSelectWidget).widget)
292674
def get_page(self, index=None):
        """"""
        if index is None:
            widget = self.pages_widget.currentWidget()
        else:
            widget = self.pages_widget.widget(index)
        return widget.widget()
656376
def widget_from_iterable(o):
        """"""
        # Dropdown expects a dict or list, so we convert an arbitrary
        # iterable to either of those.
        if isinstance(o, (list, dict)):
            return Dropdown(options=o)
        elif isinstance(o, Mapping):
            return Dropdown(options=list(o.items()))
        else:
            return Dropdown(options=list(o))