Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I want to make CDF WindowSize as constant so that the end user can not resize it either by dragging Window or by maximizing it.

Is there any in built Mathematica function to do this?

share|improve this question
Would it be correct to assume that you are producing stand alone CDF to be opened on a computer, and not a web page embedded version to be opened via plugin? –  Vitaliy Kaurov Aug 2 '12 at 18:19
@VitaliyKaurov: yes, I am asking about stand alone CDF. –  Jennifer Aug 2 '12 at 18:22
add comment

3 Answers

up vote 5 down vote accepted

You can achieve it by removing "ResizeArea" element from WindowFrameElements option of the CDF file.

For example, we generate a resizable standalone CDF and open it in Mathematica:

cdfpath = CDFDeploy[
  ToFileName[{$TemporaryDirectory}, "thisistest.cdf"],
  Manipulate[n!, {n, 1, 10, 1}],
  WindowSize -> {400, 200},
  Method -> "Standalone"];

nb = NotebookOpen[cdfpath];

Then we remove the "ResizeArea" element and save it:

SetOptions[nb, WindowFrameElements -> {"CloseBox", "ZoomBox"}]

Note the changing at the lower right corner. Now the window size of nb should be fixed.

enter image description here


As @VitaliyKaurov warned in this comment, the WindowFrameElements has a long-term hidden danger as the official document said:

This function has not been fully integrated into the long-term Mathematica system, and is subject to change.

So please use it with vigilance.

share|improve this answer
A word of caution from documentation center about "WindowFrameElements": "This function has not been fully integrated into the long-term Mathematica system, and is subject to change." ( bit.ly/QykM7T ) –  Vitaliy Kaurov Aug 2 '12 at 21:12
@VitaliyKaurov Yes I'm aware of it. But as I don't know how long exactly does "long-term" mean, I'd like to use it for good flexibility when custom notebooks. But yes! it's a hidden danger, I'll add a caution in my answer. Thank you :) –  Silvia Aug 2 '12 at 21:24
@Silvia: Is it possible to minimise the window size upto an extent and not after that? so that the end user can only have an option of increasing the window size. –  Jennifer Aug 3 '12 at 5:47
@Jennifer didn't figure out a handy method, but I think it's possible. Maybe some Dynamic things are needed in WindowSize option along with something like Dynamic[CurrentValue["WindowSize"]]. –  Silvia Aug 3 '12 at 9:09
add comment

First of all you need to be careful. For example deploying large enough content of fixed window size would create problems on small computer screens. That warning being said, this is what you can do.

Imagine this is your interactive content:

m = Manipulate[Plot[Sin[f x]/x/f, {x, -6.6, 6.6}, PlotRange -> {-.3, 1}, Filling -> 0],
     {{f, 4, "frequency"}, 1, 6, Appearance -> "Labeled"}, AppearanceElements -> None]

You can take advantage of dialog-type of Mathematica notebook using CreateDialog which by default always makes the window not-re-sizable. Then use programmatic deployment with function CDFDeploy:

CDFDeploy["Standalone.cdf", CreateDialog[{m}, WindowSize -> All],Method -> "Standalone"]

This will create Standalone.cdf CDF file in your default directory which you can find by running Directory[]. This is what you will get:

enter image description here

The WindowSize is very important, so you should read corresponding documentation articled that I linked. One of the most handy settings, besides fixed size, is actually scaled with respect to screen size settings. To Make a window that occupies one-third of the screen width and all of the screen height:

WindowSize -> {Scaled[1/3], Scaled[1]}
share|improve this answer
add comment

Try wrapping the output of the Manipulate in Panel.

This should enable you to use ImageSize and control the size of the CDF pretty well.

See the documentation:

enter image description here

This will enable you to control the size of the CDF within the CDF Window.

To better control the size of the notebook window itself look at the option inspector:

enter image description here

and the WindowSize setting.

share|improve this answer
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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