# Use SetCellGroupOpen with Dynamic

**URL:** <https://community.wolfram.com/t/use-setcellgroupopen-with-dynamic/12851>\
**Category:** Questions\
**Tags:** mathematica, ui-ux-and-ide\
**Created:** [July 16, 2018, 11:18pm UTC](https://community.wolfram.com/t/use-setcellgroupopen-with-dynamic/12851 "2018-07-16T23:18:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![b3m2a1](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/b3m2a1/32/7562_2.png) [@b3m2a1](https://community.wolfram.com/u/b3m2a1)\
**Post date:** [July 16, 2018, 11:18pm UTC](https://community.wolfram.com/t/use-setcellgroupopen-with-dynamic/12851/1 "2018-07-16T23:18:45Z")

</div>

The new inline cell openers work via a packet called `FEPrivate`SetCellGroupOpen`. The usage for this is something like:

```
MathLink`CallFrontEnd@
 FrontEnd`Value@
  FEPrivate`SetCellGroupOpen[
   cell,
   Open|Close|True|False
   ] 

```

Now I want to get this to work like the little orange clickers in the docs which have a `Dynamic` state in the second arg to their `CellGroupData`. Is there a way to make this function do that or any method that _does not involve `NotebookWrite/Put`_?

---

<div class="post-metadata">

**Author:** ![kubapod](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/kubapod/32/18662_2.png) [@kubapod](https://community.wolfram.com/u/kubapod)\
**Post date:** [July 17, 2018, 7:50am UTC](https://community.wolfram.com/t/use-setcellgroupopen-with-dynamic/12851/2 "2018-07-17T07:50:25Z")

</div>

I don’t think it can as docs seem to work on higher level. (TaggingRules).

Also, this example **DOES NOT** work but is close. I assumed `"ExampleSection" | "ExampleSubsection"` have appropriate `CounterIncrements` but they do not. If you edit Reference.nb so they have, then you could use this code. Currently it works well only for `"NotesSection" | "PrimaryExamplesSection"` and the very first ExampleSection or ExampleSubsection as the counter is fixed at 0.

```
With[{cell = NextCell[] (*whatever you want*)}
, Module[{ spec, style = First @ Flatten @ {"Style" /. Developer`CellInformation[cell]} }
  , spec = Switch[style
    , "NotesSection" | "PrimaryExamplesSection", {TaggingRules, "Openers", style}
    , "ExampleSection" | "ExampleSubsection", {TaggingRules, "Openers", style, CurrentValue[cell, {"CounterValue", style}]}
    , _, False
    ]
  ; If[
      ListQ @ spec
    , CurrentValue[ParentNotebook@cell, spec] = CurrentValue[ParentNotebook@cell, spec] /. {
        False -> True, True -> False, Open -> Closed, Closed -> Open
      }
    ]
  ]
]

```
