This is by no means a complete answer, or maybe no answer at all. I will show how to detect at least some BoxObjects in a displayed notebook, not how to construct them. Partly this was done already by @Silvia in this answer. She constructed some FrontEnd'NotebookInterfaceObjects and I will show that they indeed agree with BoxObjects. Then I will find some more BoxObjects in a given notebook, with an embarassing result.
First a slight modification of the ingenious technique used by Silvia.
Start a fresh Mathematica session and evaluate the next command.
$PreRead=(Print[#];#)&;
Activate the debugger and evaluate
(1+2)/3+1
Deactivate the debugger and evaluate
Clear[$PreRead]
The printed box structure shows some DebugTags, of which the numbers correspond to FrontEnd'NotebookInterfaceObjects, as shown by Silvia. Here I construct BoxObjects with the same numbers:
Cases[ NotebookGet[SelectedNotebook[]] , {___,PatternSequence["DebugTag","[",n_,"]"],___}:>BoxObject[ToExpression[n]], Infinity]
A nice property of BoxObjects is that when we click on the displayed number, the selection moves to the corresponding box structure. In this way we simply verify that these BoxObjects coincide with the FrontEnd'NotebookInterfaceObjects.
On my system, this way of finding BoxObjects was not quite stable. Sometimes I found 4 boxes, sometimes 6.
Now I try to find more BoxObjects in the notebook. For an existing BoxObject, we can inspect the contents with NotebookRead. If the box does not exist, the result will be $Failed. In the following command, we look for all BoxObjects in a certain range having non-empty contents. If we leave out the second condition in the If statement, we find some empty BoxObjects as well, whatever that may mean.
Table[With[{z=NotebookRead[BoxObject[n]]},
If[z=!=$Failed && z=!={}, BoxObject[n], Nothing]], {n, 1, 6000}]
Length[%]
(* list of displayed BoxObjects *)
(* 106 *)
The numbers of the found boxes all are 1 plus a multiple of 16:
Mod[%%[[All, 1]], 16] // Union
(* {1} *)
As already stated, clicking on a box number of a displayed BoxObject moves the selection to the corresponding box. By doing so, we see that sometimes a complete cell is a BoxObject, sometimes a single name or number is a BoxObject. It also happens that when we click on a box number, Mathematica crashes.
My final remark is a little bit outside the question. A NotebookObject or a CellObject can be used to change the displayed properties by using kernel commands on these objects. So I tried to do the same with a BoxObject:
SetOptions[BoxObject[2817], Background->Yellow]
Of course, the BoxObject was choosen such that the box indeed had the option Background. The effect of this command was that the background of the complete notebook became yellow. So I had to execute the above command once again, with Yellow replaced with None.
FrontEnd`NotebookInterfaceObjectI mentioned in this post? – Silvia Dec 16 '15 at 13:58DebugTagreturned is the IDs of the Boxes in the Input line, while theDynamic[EvaluationBox]gives the Box inside theDynamicBoxin the Output Cell. The IDs I think are in the some index sequence. – Silvia Dec 16 '15 at 14:18