# Setting WholeCellGroupOpener [duplicate]

When I write WholeCellGroupOpener, Mathematica autocompletes it, but it doesn't recognize it (it stays blue instead of turning black).

Example:

SetOptions[#, {CellOpen -> False, WholeCellGroupOpener -> False}] & /@
Cells[ButtonNotebook[], CellStyle -> "Section", CellTags -> "A"]


And when I evaluate it, the correct cells are closed, but I can open them again by clicking on where they were.

If it is not possible to change WholeCellGroupOpener to false in this way, is there another way of disabling the cell so that it does not open when the user clicks on it?

## 2 Answers

The problem is that options not documented/released in System context, are renamed to e.g. \$CellContextWholeCellGroupOpener.

There is a more general topic about that: Programming scripts to create and modify stylesheets: problems with contexts

So what your code does is creation of such option (you can check cell expression with Ctrl+Shift+E) which doesn't mean anything.

I'd go with a string name:

SetOptions[#, {CellOpen -> False, "WholeCellGroupOpener" -> False}] & /@
Cells[ButtonNotebook[], CellStyle -> "Section", CellTags -> "A"]


I am not sure if the code you posted is literal but in any case you need to be using Alternative instead of Or, i.e. | instead of ||:

SetOptions[#, {CellOpen -> False, WholeCellGroupOpener -> False}] & /@
Cells[EvaluationNotebook[], CellStyle -> ("Section" | "Subsection"),
CellTags -> ("A" | "B")]


• Thank you, but it does not solve my problem. If you click on the closed cell, it opens because WholeCellGroupOpener is still true. Feb 12, 2016 at 6:28
• you are correct. I had focussed my answer on the syntax errors you had prior to reading this answer and doing your edit Feb 13, 2016 at 5:18