# How to make custom attached menubars? [duplicate]

I would like to understand how to build an attached menubar. For example, Image has the following bar - an attached cell that arises when clicked on:

NotebookOpen@
FileNameJoin[{\$InstallationDirectory,
"SystemFiles/FrontEnd/SystemResources/AttachedImage2D.nb"}]


Here's a minimal example that will show the bar:

RawBoxes @ GraphicsBox[
TagBox[
RasterBox@{{{0, 0, 255}}},
BoxFormImageTag["Byte"]
], ImageSizeRaw -> {2, 2}]


So far as I can tell, the TagBox and ImageSizeRaw` options are both necessary - removing either causes the AttachedImage2D to go away.

Such a tutorial would be need to explain three things:

1. How to build the GUI cell (something that looks like AttachedImage2D)?
2. How to access/alter the data of the boxed object to which it is attached?
3. How to associate the bar to a specific type of box and trigger it on clicks?

If a developer could help explain this, there are tons of fun applications here, e.g. making an AttachedGraph2D/3D cells, etc.

• Search around for AttachedCell AttachCell. – Kuba Sep 6 '18 at 19:49