CSSuiListBox

CSSuiListBox()

CSSUILISTBOX CSS-styled list box backed by uihtml

Usage:

lb = CSSuiListBox(parent, ‘Items’, {‘Alpha’,’Beta’,’Gamma’}) lb = CSSuiListBox(parent, ‘Items’, myList, ‘Multiselect’, true, ‘Style’, ‘shadow’) lb.ValueChangedFcn = @(s,e) disp(e.Value); lb.Value = ‘Beta’; % single-select: set by string lb.Value = {‘Alpha’,’Gamma’}; % multi-select: set by cell

Inputs:

parent : ui container - parent (default: new uifigure)

Name-Value Pairs:

‘Position’ : 1x4 double - [x y w h] (default: [10 10 200 150]) ‘Enabled’ : logical - enable interaction (default: true) ‘TempDir’ : char - scratch dir (default: tempdir()) ‘Style’ : char - CSSBase style preset (default: ‘shadow’) ‘CSS’ : char - extra CSS (default: ‘’) ‘CSSFile’ : char - extra CSS file (default: ‘’) ‘Items’ : 1xN cell of char - option strings (default: {}) ‘Value’ : char or cell - initial selection (default: ‘’) ‘Multiselect’ : logical - allow multiple selection (default: false) ‘RowStriping’ : logical - alternate even-row tint (default: false) ‘StripeColor’ : char - CSS color for the stripe (default: ‘rgba(0,0,0,0.045)’) ‘ValueChangedFcn’ : @(src, evt) selection callback (default: []) ‘DoubleClickFcn’ : @(src, evt) double-click callback (default: []) Additional CSS convenience properties are forwarded to CSSBase (Color, BackgroundColor, FontSize, Padding, BorderRadius, etc.).

Outputs:

lb : CSSuiListBox handle

Notes

ValueChangedFcn event struct has fields .Source, .Value, .PreviousValue. .Value is char if single-select, cell if multi.

CSS element schema:
#css-root Outer sizing container (CSSBase-managed)

.cssui-listbox Widget-type class on #css-root .css-control Scrollable list container

.lb-item Each list row .lb-item.selected Highlighted selected row(s)

.css-disabled On #css-root when Enabled=false

Example

lb.CSS = ‘.lb-item { font-size: 13px; }’; lb.CSS = ‘.lb-item.selected { background: #1976D2; color: #fff; }’;

See also: CSSBase, CSSuiTable, CSSuiEditField

∿∿∿ Prerau Laboratory MATLAB Codebase · sleepEEG.org ∿∿∿