# BarItem class

Namespace: [Grasshopper2.UI.Toolbar](https://developer.rhino3d.com/api/gh2/namespace/grasshopper2.ui.toolbar.md) · Assembly: [Grasshopper2](https://developer.rhino3d.com/api/gh2/assembly/grasshopper2.md)

```cs
public abstract class BarItem
```

Abstract bar element implementation. Derive from this class rather than implementing IBarElement directly.

**Derived types:** [DropDown<T>](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.dropdown-1.md), [NumberSlider](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.numberslider.md), [PushButton](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.pushbutton.md), [RadioToggle](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.radiotoggle.md), [Spacer](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.spacer.md), [TextField](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.textfield.md)

## Constructors

- [BarItem](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.baritem/ctor.md): Base class constructor.

## Fields

- [StandardMaximum](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.baritem/standardmaximum.md): (static) Default maximum width of bar elements such as buttons, options and toggles.
- [StandardMinimum](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.baritem/standardminimum.md): (static) Default minimum width of bar elements such as buttons, options and toggles.

## Properties

- [AdjacentOnLeftSide](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.baritem/adjacentonleftside.md): Gets whether this element is treated as an adjacent one on the left side. This state is used when the layout code of the neighbouring element needs to decide whether to put small or large radii on its own shapes.
- [AdjacentOnRightSide](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.baritem/adjacentonrightside.md): Gets whether this element is treated as an adjacent one on the right side. This state is used when the layout code of the neighbouring element needs to decide whether to put small or large radii on its own shapes.
- [Bar](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.baritem/bar.md): Gets the toolbar this element is hosted on. This field may be null, but will be assigned by the [Bar](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.bar.md) itself once this element is added to it.
- [Bounds](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.baritem/bounds.md): Gets the visible bounds for this element. These bounds are set by the [BarItem.Bar](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.baritem/bar.md) during layout.
- [Enabled](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.baritem/enabled.md): Gets or sets whether this element is enabled. Note that if the parent toolbar is disabled, this element is disabled by implication. Thus, use the [BarItem.IsEnabled()](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.baritem/isenabled.md) function to determine the real state.
- [Icon](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.baritem/icon.md): Gets the icon, if any, associated with this element.
- [KeyCode](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.baritem/keycode.md): Gets or sets the shortcut key for this element. Whether or not this is actually used depends on the form hosting this toolbar.
- [MaximumWidth](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.baritem/maximumwidth.md): Gets the maximum width (in logical pixels) for this element.
- [MinimumWidth](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.baritem/minimumwidth.md): Gets the minimum width (in logical pixels) for this element.
- [Nomen](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.baritem/nomen.md): Gets the nomen describing this element.
- [OffColour](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.baritem/offcolour.md): Gets or sets the colour associated with the Off state, whenever meaningful.
- [OnColour](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.baritem/oncolour.md): Gets or sets the colour associated with the On state, whenever meaningful.

## Methods

- [CreateOutline](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.baritem/createoutline.md): (2 overloads)
- [Draw](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.baritem/draw.md)
- [DrawDisabled](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.baritem/drawdisabled.md): Draw this element when disabled.
- [DrawFocus](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.baritem/drawfocus.md): Draw this element when enabled and focused.
- [DrawHover](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.baritem/drawhover.md): Draw this element when enabled and hovered but not focused.
- [DrawIcon](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.baritem/drawicon.md): (2 overloads) Draw the icon (if any) into the given frame. An automatical 2-pixel paddding is created inside the frame.
- [DrawIconAndText](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.baritem/drawiconandtext.md)
- [DrawNormal](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.baritem/drawnormal.md): Draw this element when enabled and not hovered and not focused.
- [DrawText](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.baritem/drawtext.md): Draw a string into the frame.
- [FindGroupByChapter<T>](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.baritem/findgroupbychapter.md): Collect all toolbar elements which share the same nomen chapter as this element. If there is only a single element (i.e. this one) then an empty array is returned.
- [FindGroupBySection<T>](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.baritem/findgroupbysection.md): Collect all toolbar elements which share the same nomen section as this element, across every bar in the same [Bar.Bundle](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.bar/bundle.md). If there is only a single element (i.e. this one) then an empty array is returned.
- [HasNeighbourToTheLeft](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.baritem/hasneighbourtotheleft.md): Gets whether the item directly to the left of this item has an outline shape adjacent to this item.
- [HasNeighbourToTheRight](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.baritem/hasneighbourtotheright.md): Gets whether the item directly to the right of this item has an outline shape adjacent to this item.
- [IsEnabled](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.baritem/isenabled.md): Gets whether both this element and the bar it belongs to are enabled.
- [KeyDown](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.baritem/keydown.md)
- [KeyUp](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.baritem/keyup.md)
- [Layout](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.baritem/layout.md): Layout the element. This method is called automatically whenever the [BarItem.Bounds](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.baritem/bounds.md) changes.
- [MouseDoubleClick](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.baritem/mousedoubleclick.md)
- [MouseDown](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.baritem/mousedown.md)
- [MouseLeave](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.baritem/mouseleave.md)
- [MouseMove](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.baritem/mousemove.md)
- [MouseUp](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.baritem/mouseup.md)
- [NeighbourToTheLeft](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.baritem/neighbourtotheleft.md): Gets whether this toolbar element has a neighbour directly to its left.
- [NeighbourToTheRight](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.baritem/neighbourtotheright.md): Gets whether this toolbar element has a neighbour directly to its right.
- [OverrideInfo](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.baritem/overrideinfo.md): Override the info of the [BarItem.Nomen](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.baritem/nomen.md) field.
- [OverrideText](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.baritem/overridetext.md): Override the name of the [BarItem.Nomen](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.baritem/nomen.md) field.
- [SetSizeLimits](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.baritem/setsizelimits.md): Set the minimum and maximum width limits.
- [ShowTooltipAt](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.baritem/showtooltipat.md)
- [TextInput](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.baritem/textinput.md)
