Sign up ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Perhaps it's not accessible from the front end, but what is this so-called attached cell?

In[91]:= Names["*`*AttachedCell*"]

Out[91]= {"FrontEnd`AttachedCellParent", \
"PredictiveInterfaceDump`$UseAttachedCells", \

Keywords: floating elements, menu

share|improve this question
The title of your question does not seem to be related in any way to body of your question. The title is too broad to be a good question. The body is obscure; what motivated you to search on "*`*AttachedCell*"? – m_goldberg Nov 13 at 4:15
Oh I was just guessing from some spelunking that attachedcells are the mechanism it uses. – M.R. Nov 13 at 4:23
@m_goldberg fixed the title. – Kuba Nov 13 at 9:10

1 Answer 1

up vote 10 down vote accepted


One day I was playing with Developer` package and found DateSetter which uses some kind of floating elements that I found useful.

enter image description here

After taking a look at a source code I found out it was FrontEnd`AttachedCell. From the code one could learn enough to create something useful:


   parentObject,             (*Box or Cell Object*)
   {Automatic, {Left, Bottom}}, (*1*)
   {Left, Top},                 (*2*)
   "ClosingActions" -> {...}    (*3*)
  1. I don't know what an Automatic is there for but the second part is setting alignment anchor point in the parentBoxObject
  2. alignment anchor point in the attached cell
  3. "The ClosingActions determines actions which automatically dismiss the attached cells". Available actions: "ParentChanged", "EvaluatorQuit", "OutsideMouseClick", "SelectionDeparture", "MouseExit".

I couldn't figure everything out by myself so let's quote John Fultz whom I've asked about details:

  • Kuba:


    1. I'm aware it is undocumented but I'm curious if it is stable. [...]

    2. Can you give me any insight in "ClosingActions"? [...]

    3. Can I AttachCell for DockedCells elements? [...]

  • John Fultz:

    1. Yes, this functionality is used all over the place. At some point, it'll graduate to a System` level function, but even when it does, we'll probably maintain backward compatibility with the current stuff.

    2. The "ClosingActions" determines actions which automatically dismiss the attached cells. You can manually dismiss a cell by doing NotebookDelete on the attached cell's CellObject. But there are some circumstances where it's much easier to let the system do it for you. It can be a list of any of the following:

    "SelectionDeparture" -- if the selection leaves the parent, the attached cell, or any of the attached cell's children (the selection might be in the attached cell if the attached cell has InputFields).

    "ParentChanged" -- if any change is made to the parent of the attached cell

    "MouseExit" -- if the mouse leaves the region of the attached cell

    "OutsideMouseClick" -- if a click happens anywhere outside of the attached cell. This includes clicks of the right and middle mouse buttons.

    1. Yes, that works, too. Except that the docked view will clip attached cells, so if the attached cell doesn't live fully within the docked view, it may not be very useful.

My example:

attachTo[parentbox_] := MathLink`CallFrontEnd[
      EventHandler[Panel["floating panel"], 
        "MouseExited" :> (NotebookDelete[ParentCell[EvaluationBox[]]];)
      StripOnInput -> True, Background -> White, 
      CellFrameColor -> LightBlue, CellFrameMargins -> 0, CellFrame -> 2
    {Automatic, {Right, Bottom}},
    {Left, Top},
    "ClosingActions" -> {"ParentChanged", "EvaluatorQuit",  "OutsideMouseClick"}

DynamicModule[{parentBox, attachedCell},
    { "MouseEntered" :> (
          NotebookDelete @ attachedCell; attachTo[parentBox];
  Initialization :> ( parentBox = EvaluationBox[]; )

enter image description here

Notice that I'm not using "MouseExit" closing action but an EventHandler + NotebookDelete. That's because if the initial position of the attached cell is away from cursor then it won't appear at all.

Possible issues

  • the tricky thing is to get the parentBoxObject.
  • it's not the same as e.g. menu in PopupMenu since attached cell is restricted to notebook area only while the menu is able to be outside.
share|improve this answer
Thank you very much for the canonical answer (as always) :) – M.R. Nov 13 at 21:34
@M.R. You are welcome, and thanks for another interesting question :) – Kuba Nov 13 at 22:00
+1 Thanks for the digging Kuba! I was waiting for this kind of interactive floating element for years now. Didn't realize that DateSetter had it. – István Zachar Nov 14 at 9:21
@IstvánZachar No problem, I have just recently found it too. I hope this post will generate many topics with nice GUI based on this. – Kuba Nov 14 at 9:25

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.