# Tag Info

47

Mathematica does it internally by using BoxFormArrangeSummaryBox, which is quite straightforward to figure out. Example ClearAll[MyObject]; MyObject /: MakeBoxes[obj : MyObject[asc_? myObjectAscQ], form : (StandardForm | TraditionalForm)] := Module[{above, below}, above = { (* example grid *) {BoxFormSummaryItem[{"Name: ", asc["...

23

The following shows a way to emulate the summary boxes using only documented constructs: grid[g_] := Column[Row /@ MapAt[Style[#, Gray] &, g, Table[{i, 1}, {i, Length[g]}]]] foo /: MakeBoxes[c : foo[___], form : (StandardForm | TraditionalForm)] := With[{boxes = RowBox[{"foo", "[", ToBoxes[Panel[ OpenerView[ {grid[{{"...

18

The old typesetting can be restored by SetSystemOptions["TypesetOptions" -> "IconicElidedForms" -> False]; Also mentioned previously: (1), (2), (3).

17

This is not related to the output cell greying to indicate mismatch with the input cell. You can easily verify this by editing the input cell — it gets further greyed out. The new summarized display that is used for things like SparseArray, Interpolation, etc. has a setting "Interpretable" -> False. If this is the case, the output is showed in a gray ...

17

Perhaps there is a more convenient way of doing this than resorting to esoteric boxes. The following uses the code you posted to define a function: summaryDisplay = DynamicModule[{open = True, sqrplus = RawBoxes@FrontEndResource["FEBitmaps", "SquarePlusIconMedium"], sqrminus = RawBoxes@FrontEndResource["FEBitmaps", "SquareMinusIconMedium"], paneF = ...

14

In version 10 Wolfram introduced some dynamic panels in output objects. These are intended to provide some useful brief information (I guess) about what is stored. Because these panels are dynamic they trigger an unsafe dynamic content warning if the notebook is not in a trusted path. I prefer to switch this dynamic panelling off, which you can do by ...

12

edit: simplified code and an explanation I could bet I already answered that in the past but can't find. The solution works as follows: What you see is a box expression (MakeBoxes[result of evaluation]) rendered by the FrontEnd. You can inspect it via Ctrl+Shift+E or by applying ToBoxes on your expression. The latter allows you to work with boxes and ...

11

That happens during the blob creation. You can switch that off with SetSystemOptions["TypesetOptions"->"IconicElidedForms"->False]

10

The following solution is slightly more general than @Istvàn's answer, and also fixes the icon-size to what seems to be the standard. First, we define ClearAll[summaryForm]; summaryForm[name_, icon_, infos_, maxInfos_, form_, expr_] := RawBoxes@Quiet@Check[ Module[{shown, hidden}, (* convert info-table into summary items *) {shown, hidden} = Map[...

9

Yes, this is a minor evaluation leak in the formatting rules for the Dispatch summary box. You can certainly work around it by setting that system option (one of the reasons it is there is preceisly these sorts issues), but the cost is all summary boxes will be disabled, even nice and useful ones like for InterpolatingFunction and SparseArray (which should ...

7

If you want to make a nice neat way of displaying a thing with Head head, the following will work (thanks to Sjoerd): head /: Format[b : head[a_Association]] := RawBoxes[ BoxFormArrangeSummaryBox[ "NiceHeadName", b, Graphics3D[Cone[], ImageSize -> 20], {BoxFormMakeSummaryItem[{"Summary 1: ", a["sum1"]}, StandardForm], BoxForm...

6

The following code does what I think you want: Right clicking converts the selected portion into a button with a ». Clicking on the » expands the button back into the selected portion. The "HotKeys" option allows you to define rules so that a hot key will apply a desired function on the selected portion. The tooltip that is created can be customized by ...

5

The SummaryBox stuff is just a distraction. Your code: m["Append"][5]; does not change m. Hence, the summary box will show no change. Returning to your first example: m["List"] = Range@10 This could be made to work with the MutationHandler framework. For example: SetAttributes[myObjectHandler, HoldAll]; myObjectHandler[Set[(m_Symbol?myObjectQ)[...

5

These are stored in BoxFormGenericIcon and you can see the entire list as a Dataset like: Dataset@ Replace[ DownValues@BoxFormGenericIcon, (Verbatim[HoldPattern][HoldPattern[BoxFormGenericIcon[ob_]]] :> icon_) :> <| "Object" -> ob, "Icon" -> icon |>, 1 ] One stellar example of graphic design is the icon ...

4

You can use MakeBoxes to format output pretty much however you like. This is what Mathematica does for InterpolatingFunction. You may be able to glean something by inspecting the output cell or from FormatValues[InterpolatingFunction]. Unlike InterpolatingFunction, I included an Interpretation, which means that the output in the notebook may be copied and ...

4

Although I strongly suggest you just create and use your own formatting function if possible, e.g. form[Red], the question of modifying the internal behavior is interesting. You can either turn off the automatic color directive formatting and define your own MakeBoxes rules on e.g. RGBColor to take its place, or you can modify the internal function used to ...

4

You will really need to roll your own color bar, which isn't too difficult. Here is an example of making a highly customized color bar. With[{n = 24}, Graphics[ Table[{Hue[i/n], Translate[Rectangle[{0, 0}, {1, 1}], {i, 0}]}, {i, 0, n - 1}], ImageSize -> 550, PlotRangePadding -> None, AspectRatio -> 3/n, Frame -> True, FrameTicks ...

3

This is basically @Kuba's answer from his comment: MyObject /: MakeBoxes[obj:MyObject[asc_], form_] := With[ { above = { {BoxForm`SummaryItem[{"Name: ", asc["Name"]}]}, { Pane[ Row[{Style["Expression: ", "SummaryItemAnnotation"], asc["Expression"]}], {300, Automatic}, BaselinePosition->...

Only top voted, non community-wiki answers of a minimum length are eligible