0
$\begingroup$

Given a cell group containing two subcells...

  1. If you double click the bracket of the first cell, you collapse the group behind the first cell in that group.

  2. If, instead, you double click on the bracket of the second cell in that group you collapse that group behind the second cell in that group.

With WholeCellGroupOpener turned on...if you single click ANYWHERE in the first cell, you collapse that group behind the first cell in that group.

I would like to find a way to collapse the group behind the second cell by single-clicking anywhere in the second cell, basically achieving the same functionality as WholeCellGroupOpener.

Is this possible?

The animation below should help clarify my request. The group has WholeCellGroupOpener turned on.

enter image description here

$\endgroup$
  • $\begingroup$ Looks like you might be able to do it with CellEventActions and the front-end token "SelectionCloseUnselectedCells". E.g. SelectionMove[EvaluationCell[], All, Cell];FrontEndTokenExecute["SelectionCloseUnselectedCells"] $\endgroup$ – b3m2a1 Apr 3 '19 at 8:57
1
$\begingroup$

This'll kinda imitate it:

CellEventActions :> {
  "MouseClicked" :> Switch[CurrentValue["MouseClickCount"],
    1, 
     SelectionMove[EvaluationCell[], All, Cell];
     FrontEndTokenExecute["SelectionCloseUnselectedCells"],
    2,
     SelectionMove[EvaluationCell[], All, Cell];
     FrontEndTokenExecute["OpenCloseGroup"]
    ]
  }

If you click once it closes and if you double click it opens

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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