2
$\begingroup$

I want to ask how can I control the CDF WindowSize in such a way that the end user can minimise its size upto some extent only. For example, If the WindowSize is less than or equal to {300,200}, then it should not be minimised but, it can be maximised.

Dynamic[(width = CurrentValue["WindowSize"][[1]];
        height = CurrentValue["WindowSize"][[2]];
 If[width <= 300, (width = 301), (width = CurrentValue["WindowSize"][[1]])];
 If[height <= 200, (height = 201), (height = CurrentValue["WindowSize"][[2]])];
 Panel[Button["Click1"], {width, height}, ImageSize -> {width, height}])]
$\endgroup$
2
$\begingroup$

The following code seems to be a possible start point, though far from satisfying:

CreateDocument[{
  Cell[BoxData[
    DynamicWrapperBox[

     RowBox[{"WindowSize: ",
       DynamicBox[ToBoxes[CurrentValue[WindowSize], StandardForm]]}],

     SetOptions[EvaluationNotebook[],
      WindowSize -> {Max[300, CurrentValue[WindowSize][[1]]],
        Max[200, CurrentValue[WindowSize][[2]]]}]
     ]
    ]]}, WindowSize -> {300, 200}]
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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