According to 116030:

Front end options, which includes all box options, can take Dynamic heads. That basically means that the FE will compute the value of the Dynamic and use it for the option. And that it will be updated whenever a Dynamic dependency updates.

There is even a nice example with Visible 1112.

The problem is that for WindowSize/Margins options are overwritten with absolute values as soon as I use window frame elements (resize aread etc.) and move/resize the window.

CurrentValue[EvaluationNotebook[], {TaggingRules, "size"}] = 
  1000 {1, 1/GoldenRatio};

SetOptions[EvaluationNotebook[],  WindowSize ->  Dynamic[
  CurrentValue[ EvaluationNotebook[], {TaggingRules, "size"}]]

Dynamic @ InputForm @ CurrentValue[EvaluationNotebook[], WindowSize]
Dynamic[CurrentValue[EvaluationNotebook[], {TaggingRules, "size"}]]

and after resizing:

{1000, 619}

Can WindowSize and related options remain Dynamic during interaction with a notebook? Is this expected to happen?

It works for controllers:

DynamicModule[{x = {100, 100}},
 Pane[Dynamic[x], ImageSize -> Dynamic[x],
  AppearanceElements -> All
  • $\begingroup$ I don't see any way to interact with the front-end at the level you seem to need. What are you trying to accomplish? If I knew that, perhaps I could suggest a work-around. $\endgroup$
    – m_goldberg
    Sep 5, 2016 at 18:04
  • $\begingroup$ @m_goldberg I wanted to put there something like Dynamic[temp, Initialization :> (temp = init)], where both are pointing to some TaggingRules. The point would be to have "non-saveable options" so that e.g. WindowSize will always reset to init value when nb is reopened. I could do that with NotebookDynamicExpression but it is unique and I would rather avoid that. $\endgroup$
    – Kuba
    Sep 5, 2016 at 18:26
  • $\begingroup$ So you want a notebook that doesn't remember its size between sessions, but always opens at fixed size that you have set? $\endgroup$
    – m_goldberg
    Sep 5, 2016 at 19:34
  • $\begingroup$ @m_goldberg yes, but that is another question I will probably ask later. $\endgroup$
    – Kuba
    Sep 6, 2016 at 5:13


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.