4
$\begingroup$

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?

$\endgroup$
4
$\begingroup$

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

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"]
|improve this answer|||||
$\endgroup$
7
$\begingroup$

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")]

enter image description here

|improve this answer|||||
$\endgroup$
  • 1
    $\begingroup$ Thank you, but it does not solve my problem. If you click on the closed cell, it opens because WholeCellGroupOpener is still true. $\endgroup$ – Sofic Feb 12 '16 at 6:28
  • $\begingroup$ you are correct. I had focussed my answer on the syntax errors you had prior to reading this answer and doing your edit $\endgroup$ – Mike Honeychurch Feb 13 '16 at 5:18

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