I am trying to make a CDF application that takes the user's system information (screen information) and adjusts the size of the application to give a seamless experience over different screens with widely varying display properties.

Below is the code I tried. It should have worked, but it doesn't. I am very confused. The CDF is intended to be deployed in Player Pro/Mathematica.

         Panel[GraphicsGrid[ConstantArray[1, {48, 78}],
                            ImageSize -> {800, 500},
                            Background -> RGBColor[.745, .886,.1],
                            Alignment -> {Left,Top},
                            ItemAspectRatio -> 1
                           ](*GraphicsGrid is Closed*), 
               Background -> Gray,
               Alignment ->{Center, Center}
               ](*Panel is Closed*)
        }])(*Column is Closed*), 
        WindowSize ->Dynamic[{Round[N[((780/96)*SystemInformation["Devices","ScreenInformation"][[1, 4, 2]])]], 
                                  Round[N[((780/96)*SystemInformation["Devices","ScreenInformation"][[1, 4, 2]])]]}]
    ](*CreateDocument is Closed*)
](*CdfDeploy is closed*)
  • $\begingroup$ How is the code not working? Do you get an error message? What behavior are you seeing when you run the code? $\endgroup$ – Searke Oct 10 '12 at 19:48
  • $\begingroup$ Is WindowSize->Full what you are looking for (full screen for whatever device is being used)? $\endgroup$ – Mike Honeychurch Oct 10 '12 at 22:28
  • $\begingroup$ When I have deployed it in to CDF, that CDF width and height in different system is same as it was in my system. But both have different screen resolution. $\endgroup$ – subbu Oct 11 '12 at 5:23

This might not be completely what you want, but it works:

CDFDeploy[SystemDialogInput["FileSave"], DocumentNotebook[
         GraphicsGrid[ConstantArray[1, {48, 78}], ImageSize -> {800, 500}, 
                 Background -> RGBColor[0.745, 0.886, 0.1], 
          Alignment -> {Left, Top}, 
                 ItemAspectRatio -> 1], Background -> Gray, 
         Alignment -> {Center, Center}]}]], 
       WindowSize -> Flatten[Differences /@ 

        First["ScreenArea" /. 
          SystemInformation["Devices", "ScreenInformation"]]]]
| improve this answer | |
  • $\begingroup$ If I assign the below code to the WindowSize ,then it's not working.....why? {Round[N[780/96* First["Resolution" /. SystemInformation["Devices", "ScreenInformation"]]]], Round[N[480/96* First["Resolution" /. SystemInformation["Devices", "ScreenInformation"]]]]} $\endgroup$ – subbu Oct 11 '12 at 9:29
  • $\begingroup$ Because Resolution is not WindowSize. $\endgroup$ – Rolf Mertig Oct 11 '12 at 9:58
  • $\begingroup$ @ Rolf Mertig : your code is working fine but the problem was whenever we open that cdf, the taskbar overlaps the horizontal scrollbar...why is that happening? $\endgroup$ – subbu Oct 11 '12 at 10:29

I know this is less flexible than the above solution, but it's fast and does most of the logic for you.... try doing this: WindowSize->{Scaled[1/2],Scaled[1/2]}

| improve this answer | |

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.