Arranges child controls in a grid of rows and columns. The common case is a two or three column grid where the first column holds labels describing values and the remaining columns hold the controls that edit those values, which produces something that looks like the Rhino object properties pages. Children fill the grid in row major order: a new row starts every ColumnCount children, so a two column grid built by adding label, control, label, control, ... reads the way it looks. Settings can be made before or after the grid is added to a document. The ones made beforehand are held here and applied when the native grid is created.

Constructors

UserInterfaceGrid

#Since v9.0
public UserInterfaceGrid()

UserInterfaceGrid

#Since v9.0
public UserInterfaceGrid(int columnCount)
columnCount (int)

Properties

BackgroundClaimsMouse

#Since v9.0
public bool BackgroundClaimsMouse { get; set; }
Whether a click where the grid has no child control belongs to the grid or to whatever is behind it. The default is false, so clicks on the padding, on the gaps between cells and on empty cells go through to the viewport, which is what a heads up display over a model wants.

BackgroundColor

public Color BackgroundColor { get; set; }
Color the control is filled with: the face of a button, the track of a slider, the box of a check box or radio button, the field of a text box, the whole rectangle of a label, icon or grid. Color.Empty, the default, means the control chooses the color for the theme that is in use and follows the theme when it changes. Labels and icons draw no background when this is Color.Empty. A grid fills with the theme's panel color when it is a top level control, and draws no background when it is inside another control. UserInterfaceGrid.BackgroundOpacity makes the theme color see through, or turns the background off at 0.
inherited fromUserInterfaceControl

BackgroundOpacity

#Since v9.0
public double BackgroundOpacity { get; set; }
How opaque the background is, from 0 (not drawn at all) to 1 (solid, the default). Leave BackgroundColor as Color.Empty and the grid uses the theme's panel color at this opacity, which gives a see through panel over the model that still follows the theme. A BackgroundColor that was set is drawn at this opacity on top of its own alpha. The border is not affected.

BorderColor

#Since v9.0
public Color BorderColor { get; set; }

BorderThickness

#Since v9.0
public double BorderThickness { get; set; }

BoundToActiveView

public bool BoundToActiveView { get; set; }
inherited fromUserInterfaceObjectBase

ChildCount

#Since v9.0
public int ChildCount { get; }
Number of cells that have been filled, including the empty ones added with AddEmptyCell. This is not the same as ColumnCount * RowCount.

ColumnCount

#Since v9.0
public int ColumnCount { get; set; }
Number of columns in the grid. The default is 1. Changing the column count reflows the children that have already been added.

ColumnSpacing

#Since v9.0
public double ColumnSpacing { get; set; }
Space between columns in logical pixels. The default is 6.

CornerRadius

#Since v9.0
public double CornerRadius { get; set; }

HasKeyboardFocus

public bool HasKeyboardFocus { get; }
Does this object have keyboard focus? An object with keyboard focus gets first refusal on what is typed in a viewport; what it does not use carries on to the command line as usual.
inherited fromUserInterfaceObjectBase

HorizontalAlignment

public ControlHorizontalAlignment HorizontalAlignment { get; set; }
inherited fromUserInterfaceControl

Location

public PointF Location { get; set; }
inherited fromUserInterfaceControl

RowCount

#Since v9.0
public int RowCount { get; }
Number of rows the current children occupy, computed from the child count, the column count and any column spans.

RowHeight

#Since v9.0
public double RowHeight { get; set; }
Height of every row in logical pixels. The default is 0, which means each row is as tall as the tallest control in it.

RowSeparatorColor

#Since v9.0
public Color RowSeparatorColor { get; set; }

RowSeparators

#Since v9.0
public bool RowSeparators { get; set; }
Draw a horizontal line between every pair of rows. Off by default.

RowSpacing

#Since v9.0
public double RowSpacing { get; set; }
Space between rows in logical pixels. The default is 2.

Size

public SizeF Size { get; set; }
inherited fromUserInterfaceControl

Text

public virtual string Text { get; set; }
inherited fromUserInterfaceControl

TextColor

public Color TextColor { get; set; }
Color used to draw the text. Color.Empty, the default, means use the standard text color for the theme that is in use.
inherited fromUserInterfaceControl

TextHeight

public float TextHeight { get; set; }
Height of the text in logical pixels. A value of 0, the default, means use the standard control font height. Controls that draw no text ignore this setting.
inherited fromUserInterfaceControl

TextHorizontalAlignment

public ControlHorizontalAlignment TextHorizontalAlignment { get; set; }
Where the text sits inside the control's rectangle. This is not the same as HorizontalAlignment, which is where the control sits inside its parent.
inherited fromUserInterfaceControl

TextVerticalAlignment

public ControlVerticalAlignment TextVerticalAlignment { get; set; }
Where the text sits inside the control's rectangle. This is not the same as VerticalAlignment, which is where the control sits inside its parent.
inherited fromUserInterfaceControl

Tooltip

public string Tooltip { get; set; }
Text shown in a tooltip when the mouse rests over this object. Null or an empty string means no tooltip, which is what an object starts with. One tooltip is on screen at a time; whichever object the mouse is over owns it.
inherited fromUserInterfaceObjectBase

TrackingPoint

public Point3d? TrackingPoint { get; set; }
3d location that control "sticks" to if not null
inherited fromUserInterfaceControl

VerticalAlignment

public ControlVerticalAlignment VerticalAlignment { get; set; }
inherited fromUserInterfaceControl

Visible

public bool Visible { get; set; }
Is the user interface object visible? Objects that are not visible will not be drawn and will not receive mouse events
inherited fromUserInterfaceObjectBase

Methods

AddChild

#Since v9.0
public void AddChild(UserInterfaceControl child)
Append a control to the next cell.
child (UserInterfaceControl)

AddEmptyCell

#Since v9.0
public void AddEmptyCell()
Append a cell with nothing in it. Use this to leave a hole in a row.

AddHeading

#Since v9.0
public UserInterfaceLabel AddHeading(string text)
Append a label that spans every column, for a section heading.
text (string)

AddLabel

#Since v9.0
public UserInterfaceLabel AddLabel(string text)
Append a label to the next cell, which is what most first column cells are. The label is returned so that its text alignment, color or height can be adjusted.
text (string)

Cell

#Since v9.0
public UserInterfaceControl Cell(int row, int column)
Control in a cell by row and column, or null when that cell is empty. The grid has to have been added to a document for this to find anything, since it is the native grid that knows which cell a child ended up in.
row (int)
column (int)

Child

#Since v9.0
public UserInterfaceControl Child(int index)
Control in a cell, or null for an empty cell or an out of range index.
index (int)

ComputedRectangle

public RectangleF ComputedRectangle(RhinoView view, bool logicalPixels)
inherited fromUserInterfaceControl
view (RhinoView)
logicalPixels (bool)

EnableRowSeparatorBelowRow

#Since v9.0
public void EnableRowSeparatorBelowRow(int row, bool on)
Draw a horizontal line under one row, for a heading row that wants a rule under it when a line between every row would be too much. RowSeparators draws them all whatever this is set to.
row (int)
on (bool)

GetChildColumnSpan

#Since v9.0
public int GetChildColumnSpan(int index)
index (int)

GetColumnSizing

#Since v9.0
public UserInterfaceGridColumnSizing GetColumnSizing(int column)
column (int)

GetColumnWidth

#Since v9.0
public double GetColumnWidth(int column)
Width of a column in logical pixels as of the most recent layout. This is 0 until the grid has been drawn once.
column (int)

GetComputedRowHeight

#Since v9.0
public double GetComputedRowHeight(int row)
Height of a row in logical pixels as of the most recent layout. This is 0 until the grid has been drawn once.
row (int)

InsertChild

#Since v9.0
public void InsertChild(UserInterfaceControl child, int index)
Insert a control at a cell index, shifting the controls after it along.
child (UserInterfaceControl)
index (int)

IsMouseOver

protected virtual bool IsMouseOver(MouseState mouse)
Called to test if the mouse is actively over this object
inherited fromUserInterfaceObjectBase
mouse (MouseState)
Return true if the mouse is over this object

IsRegistered

public bool IsRegistered()
Is this user interface object active
inherited fromUserInterfaceObjectBase

OnDraw

protected virtual void OnDraw(DrawEventArgs args)
All user interface objects are drawn and can customize their look with the OnDraw function
inherited fromUserInterfaceObjectBase
args (DrawEventArgs)

OnMouseClick

protected virtual void OnMouseClick(MouseState mouse)
Called during a mouse click event on this object
inherited fromUserInterfaceObjectBase
mouse (MouseState)

OnMouseDoubleClick

protected virtual void OnMouseDoubleClick(MouseState mouse)
Called during a mouse double click event on this object
inherited fromUserInterfaceObjectBase
mouse (MouseState)

OnMouseDown

protected virtual void OnMouseDown(MouseState mouse)
Called when the mouse goes down on this object
inherited fromUserInterfaceObjectBase
mouse (MouseState)Current mouse state when this event occurs

OnMouseEnter

protected virtual void OnMouseEnter(MouseState mouse)
Called when the mouse goes over this object
inherited fromUserInterfaceObjectBase
mouse (MouseState)

OnMouseLeave

protected virtual void OnMouseLeave(MouseState mouse)
Called when the mouse leaves this object
inherited fromUserInterfaceObjectBase
mouse (MouseState)

OnMouseMove

protected virtual void OnMouseMove(MouseState mouse)
Called when the mouse is moved
inherited fromUserInterfaceObjectBase
mouse (MouseState)

OnMouseUp

protected virtual void OnMouseUp(MouseState mouse)
Called when the mouse is released on this object
inherited fromUserInterfaceObjectBase
mouse (MouseState)

OnRunCommand

protected virtual Result OnRunCommand(RhinoDoc doc, RunMode mode, MouseState mouse)
Called after the above RunCommand function is called. This will be executing while inside of a Rhino command.
inherited fromUserInterfaceObjectBase
doc (RhinoDoc)Document that the command is running in
mode (RunMode)Interactive or scripted mode
mouse (MouseState)Mouse state that was passed to RunCommand
Result of the command. The default implementation returns Success

RegisterForAllDocuments

public bool RegisterForAllDocuments()
Make this object visible for all documents. Typically you will only have user interface objects work with single documents. For that case, call doc.ViewUserInterface.Add
inherited fromUserInterfaceObjectBase

RemoveAllChildren

#Since v9.0
public void RemoveAllChildren()
Empty the grid.

RemoveChild

#Since v9.0
public UserInterfaceControl RemoveChild(int index)
Take a control out of the grid. Returns the control that was in the cell, or null for an empty cell or an out of range index.
index (int)

RunCommand

public void RunCommand(MouseState mouse)
Call RunCommand to have the virtual OnRunCommand function executed in the scope of a Rhino command. If you are modifying the document from one of the mouse functions on this object, this is the best approach to do so since changes made inside of a command are recorded for undo.
inherited fromUserInterfaceObjectBase
mouse (MouseState)Current mouse state. This is handed back to OnRunCommand

SetChildColumnSpan

#Since v9.0
public void SetChildColumnSpan(int index, int span)
Number of columns a cell occupies. The default is 1. Use this for a section heading or a control that runs the full width of the grid. A span is clamped to the number of columns left in the row.
index (int)
span (int)

SetColumnAutoWidth

#Since v9.0
public void SetColumnAutoWidth(int column)
Make a column as wide as the widest control in it. Controls report their width from their computed size, so a label column sized this way is exactly as wide as its longest description.
column (int)

SetColumnContentAlignment

#Since v9.0
public void SetColumnContentAlignment(int column, ControlHorizontalAlignment horizontal, ControlVerticalAlignment vertical)
How the controls in a column sit in their cells. The default is Stretch / Center, which makes a control fill the column width and center itself in the row. Any horizontal setting other than Stretch gives the control the width it reports from its computed size.
column (int)
horizontal (ControlHorizontalAlignment)
vertical (ControlVerticalAlignment)

SetColumnFixedWidth

#Since v9.0
public void SetColumnFixedWidth(int column, double width)
Give a column a width in logical pixels that is never resized.
column (int)
width (double)

SetColumnFlexibleWidth

#Since v9.0
public void SetColumnFlexibleWidth(int column, double weight)
Have a column share the width the fixed and auto columns do not use. With one flexible column that column gets all of the remaining width; with more than one the remainder is divided in proportion to the weights.
column (int)
weight (double)

SetColumnMinimumWidth

#Since v9.0
public void SetColumnMinimumWidth(int column, double minimumWidth)
Width a column never goes below, in logical pixels. The default is 0.
column (int)
minimumWidth (double)

SetPadding

#Since v9.0
public void SetPadding(double left, double top, double right, double bottom)
left (double)
top (double)
right (double)
bottom (double)

SetPadding

#Since v9.0
public void SetPadding(double padding)
Space between the edges of the grid and its cells in logical pixels. The default is 6 on all four sides.
padding (double)

SetSvg

public void SetSvg(string svg)
inherited fromUserInterfaceControl
svg (string)

Unregister

public void Unregister()
Unregister this object
inherited fromUserInterfaceObjectBase