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 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.

CDFDeploy[SystemDialogInput["FileSave"], 
     CreateDocument[(Column[{Dynamic[CurrentValue["WindowSize"]], 
         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*)
share|improve this question
    
How is the code not working? Do you get an error message? What behavior are you seeing when you run the code? –  Searke Oct 10 '12 at 19:48
    
Is WindowSize->Full what you are looking for (full screen for whatever device is being used)? –  Mike Honeychurch Oct 10 '12 at 22:28
    
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. –  subbu Oct 11 '12 at 5:23

2 Answers 2

up vote 3 down vote accepted

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

CDFDeploy[SystemDialogInput["FileSave"], DocumentNotebook[
         Column[{Dynamic[CurrentValue["WindowSize"]], 
             Panel[
         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"]]]]
share|improve this answer
    
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"]]]]} –  subbu Oct 11 '12 at 9:29
    
Because Resolution is not WindowSize. –  Rolf Mertig Oct 11 '12 at 9:58
    
@ 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? –  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]}

share|improve this answer

Your Answer

 
discard

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.