ZirconBreadcrumbs
A breadcrumbs control is used to show hierarchy. It pairs nicely with file browsers and other nested content.
Requirements
This control requires Xojo 2020r2 and Artisan Kit 1.2.2. Only desktop projects are supported.
Installation
Open the binary project and copy both the ZirconBreadcrumbs class and ArtisanKit module into your project. If you already use Artisan Kit and encounter compile errors with the control, your ArtisanKit module needs to be updated to the included version.
Getting Started
Drag a ZirconBreadcrumbs control onto a window, just like any other control. The control can support any vertical height, but the default height of 29 pixels usually works best.
Events
Event CellHold (CellIndex As Integer) As Boolean
The user has held their mouse down on an item. This could be used to show a menu allowing the user to change that level of hierarchy.
Event Change ()
Works exactly like the Change
event from a ListBox. It fires when a cell has been clicked.
Properties
ActiveBackgroundColor As ColorGroup
The background color used for the currently selected cell.
ActiveTextColor As ColorGroup
The text color used for the currently selected cell.
BackgroundColor As ColorGroup
The color used behind the entire control, including behind the border. The background color will show through the border if the border has transparency.
BorderColor As ColorGroup
The color used for the borders and the small arrows between each cell.
BorderPosition As Integer
Describes the edges the control should draw a border. Use the BorderNone
constant for no border. The BorderTop
, BorderBottom
, BorderLeft
, and BorderRight
constants can be OR
'd together to achieve borders on multiple edges. For example, to get a top and bottom border, use: BorderPosition = BorderTop Or BorderBottom
.
CellCount As Integer
The number of cells. You can set this property and the control will add empty cells or remove cells as necessary.
TextColor As ColorGroup
The color used to draw text for cells that are not selected.
Value As Integer
The currently selected cell. Zero-based index like most lists in Xojo.
Methods
Sub AddCells(ParamArray Cells() As String)
Adds the cells to the end of the hierarchy.
Function Cell (Index As Integer) As String
Sub Cell (Index As Integer, Assigns NewValue As String)
Used to get or set the cell caption at the zero-based index.
Function CellIcon (Index As Integer) As Picture
Sub CellIcon (Index As Integer, Assigns NewValue As Picture)
Used to get or set the cell icon at the zero-based index. It is ok to set this to Nil
to remove an icon.
Function CellIconType (Index As Integer) As Integer
Sub CellIconType (Index As Integer, Assigns NewValue As Integer)
Used to get or set the type of icon to draw on the cell. Use the following constants:
IconTypeAlpha
: The icon will be drawn to match the text color according to the icon's alpha channel.IconTypeMask
: The icon will be drawn to match the text color by treating the icon as a black and white mask. Works best with icons that do not have alpha channels.IconTypeFullColor
: The icon will be drawn as-is.
Sub DeleteAllCells ()
Deletes all the cells.
Sub InsertCells (Index As Integer, ParamArray Cells() As String)
Adds cells starting at the given zero-based index.
Sub RemoveCells (Index As Integer, Count As Integer = 1)
Removes one or more cells starting at the given index.