Skip to main content

ArrangeSummaryBox

Wolfram Kernel
Execution environment
BoxForm`
Context
BoxForm`ArrangeSummaryBox[head_Symbol, interpretation_, icon_Graphics | _Graphics3D | _Image | None, summary_List, Null, opts___] _RowBox

A decoration for summarizing internals of any WL expression to a human-readable form

info

A decoration behaves like a single symbol and should contain all covered data.

Usually it is applied to the output expression using MakeBoxes and StandardForm representation

$icon = Graphics[{Red, Disk[]}];

MyObject /: MakeBoxes[obj : MyObject[asc_Association], StandardForm] :=
Module[{above, below},
above = {
{BoxForm`SummaryItem[{"Name: ", asc["Name"]}]},
{BoxForm`SummaryItem[{"Variables: ", asc["Variables"]}], BoxForm`SummaryItem[{"Length: ", asc["Length"]}]}
};

BoxForm`ArrangeSummaryBox[
MyObject, (* head *)
obj, (* interpretation *)
$icon, (* icon, use None if not needed *)
(* above and below must be in a format suitable for Grid or Column *)
above, (* always shown content *)
Null (* expandable content. Currently not supported!*)
]
];

where $icon can be any Image or Graphics or Graphics3D or other arbitrary WLJS Function that can output to the DOM.

Each line is a

BoxForm`SummaryItem[{label_String, expr_}]

where expr is an expression that will be printed in place

Let us test this

MyObject[<|
"Name" -> "My particular object",
"Length" -> 10,
"Variables" -> {a,b,c},
"Date" -> Today,
MetaInformation -> "more info..." |>]

This expression is still valid for normal coping and evaluating

Supported output forms

Options

"Event"

A string identifier used for attaching event listeners to a widget. Since this is a wrapper over ViewBox and RowBox, see more on its page.