There are extensive explanations in the Examples section on how to use TabbedView2 with its many configuration options .
version: 1.05 , Oct 28, 2016
author: Jost Muxfeldt
TabbedView2 has a number of new features compared with TabbedView.
The new TabbedView2 now holds an Array of TabbedViewTab instances. The creation syntax is just like other Views:
You then add defaults, followed by the individual tabs, setting their individual instance variables.
See TabbedViewTab .
Example:
Old Syntax
New Syntax
create a Tabbed View
parent |
a parent view. if nil, then a new window is created |
bounds |
Rect . if nil then the parent Rect is used |
returns a TabbedView2
the container for all the views
boolean |
If a window was created automatically, then this sets whether it is always on top. |
If a window was created automatically, then this returns the window.
get the TabbedViewTab instance at index.
a TabbedViewTab instance. A TabbedViewTab instance responds to .asView, so it can be used to fill a parent argument, just like any other view can.
an array of TabbedViewTab instances.
sets the resize flag (1-9 ) of the enclosing view. see Resize behaviour
Creates a new TabbedView2, copying all of the settings of the current on, other that the tabs. This method is also used internally when detaching tabs under QT.
parent |
a parent view. if none, a new window is created. |
x |
If a new window is created, it will be created offset from this x position by 20px (mainly for internal use) |
y |
If a new window is created, it will be created offset from this y position by 20px (mainly for internal use) |
The new TabbedView2 instance.
adds a TabbedViewTab instance
label |
string, the label |
index |
int, (optional) the index at which the tab is inserted (if nil, add to the end) |
scroll |
Boolean, default false. Must be set before creation of tab. |
the new TabbedViewTab
inserts a TabbedViewTab instance at index
index |
the index at which the tab is inserted |
label |
(describe argument here) |
scroll |
Boolean, default false. Must be set before creation of tab. |
the new TabbedViewTab
Boolean or Function: {arg thisView; return boolean}. default: true; Set to false to disable regular tab dragging (position or order changing by drag);
if tabs are detached, you can lose a tab if you close its window. so this allows you to prevent that by setting it to false. The window will still close when the last tab has been dragged out of it.
quickly creates a bunch of tabs. for texting TabbedView2 settings Tab labels will be i++string
i | |
string |
remove tab at Index
index |
the index of the tab to be removed |
selects one of the tabs
index |
int, the index to focus |
returns the focused tab
symbol |
\left, \top, \right, or \bottom. |
Lockes the \left, \top, \right, or \bottom position of the tabs. You still can change the order of the tabs themselves by dragging.
bool |
default false. |
Boolean or Function: {arg thisView; return boolean}. Set tabs parallel or perpendicular to container edges. default true. (Set tabs parallel);
Prevents Double-Click changing of followEdges.
bool |
default false. |
Setting the position or followEdges instance variables
Automatically saves the state of the TabbedView2 to given path in the Archive.
symbols |
symbol1, symbol2, symbol3, ... |
Array: Determines which keys will be archived when autoArchive is enabled.
default=[\indexes, \followEdges, \tabPosition, \tabFocus]
array |
Array of Symbols, may include only |
Saves the state of the TabbedView2 to given path in the Archive.
symbols |
symbol1, symbol2, symbol3, ... |
Restores the state of the TabbedView2 from given path in the Archive.
symbols |
symbol1, symbol2, symbol3, ... |
reset the tab colors, cycling through default color arrays.
colorArray |
Array of Colors sets the default colors of the tab widgets. New tabs will cycle through these colors, though these can be overridden in the TabbedViewTab instance. |
colorArray |
Array of Colors sets the default unfocusedColors colors of the tab widgets. New tabs will cycle through these colors, though these can be overridden in the TabbedViewTab instance. |
colorArray |
Array of Colors sets the default background colors of the Composite/Scroll Views. New tabs will cycle through these colors, though these can be overridden in the TabbedViewTab instance. |
colorArray |
Array of Colors sets the default label string colors. New tabs will cycle through these colors, though these can be overridden in the TabbedViewTab instance. |
colorArray |
Array of Colors sets the default focused label string colors. New tabs will cycle through these colors, though these can be overridden in the TabbedViewTab instance. |
recalculate all geometry values and redraw tabs
int |
int or \auto ; a fixed tab width, or "auto" for automatic tab width (default "auto", unless using themes). Can be overridden in in the TabbedViewTab instance. |
int |
if autosizing is on, then this determines left and right padding from the label text. Can be overridden in in the TabbedViewTab instance. |
int |
int or \auto . a fixed tab height, or "auto" for automatic tab height (default "auto", unless using themes) |
int |
the radius in pixels of the rounded tab corners |
int |
set the size of the clickbox and detach icons in pixels. default is 15 |
point |
Point ; a multiplication factor for a string/tab width for GUI.swing only. default Point(0.52146,1.25) |
set the font
use CompositeView style GUI
use FlowView style GUI
(There are some color differences for swing)
defaults on *new, but other themes use fixed widths:
uses scroll:true in the inner tab
turn on/off scopes , e.g.
The tabs are drawn with user view which have a clear focus frame on Cocoa. On Swing, the frame cannot be made clear, so by default the tabs are unfocused after clicking. You can change this if it interferes with your tabbing scheme.
tabWidth defaults to \auto on *new, but other themes use fixed widths:
Swing fonts only work within certain limits for now. use swingFactor_ to adjust the conversion.
labelPadding only has an effect on auto width
Execute the code below to test all the features and parameters.