Message Boards Message Boards

Popup windows in CDF player

Posted 6 years ago

I am trying to give information to the user of the code via popup windows with CreateDialog. It is working fine when I use .nb file, the windows has the information and the plots and after 5seconds pause they close. But when I save .nd file as EnterPrise CDF it is not working, no windows there for I don't know if they would close. I don't know why? Any ideas. Here is a "toy code" what I am trying to do.

Get[FileNameJoin[{NotebookDirectory[EvaluationNotebook[]], 
"Trialpack3.wl"}]]
Panel@Framed[DynamicModule[{Heval = 1, Leval = 1},
 Grid[{
 {Style["                              "], SpanFromLeft},
 {Style["                Inputs ", 16, Blue], SpanFromLeft},
 {Style["                              "], SpanFromLeft},
 {Row[{Style["H, (m) ", 12, Blue, Editable -> False], 
    InputField[Dynamic[Heval], FieldSize -> {10, 1.5}]}, 
   Spacer[70]], 
  Row[{Style["L, (m) ", 12, Blue, Editable -> False], 
    InputField[Dynamic[Leval], FieldSize -> {10, 1.5}]}, 
   Spacer[45]]},
 {Grid[{ {Style["  ", 12, Black, Editable -> False]}, {Button[
      Style["Compute", Green, Bold],
      Res = Trialpack3`MainFunc[Heval, Leval];, 
      Method -> "Queued"]}}], SpanFromLeft},
 {Style["", 12, Blue], Style["", 12, Blue]}
 }],
 Initialization :> (
 Get[FileNameJoin[{NotebookDirectory[EvaluationNotebook[]], 
    "Trialpack3.wl"}]])
  ], Background -> Lighter[Gray, .6]]

And the package file is

BeginPackage["Trialpack3`"];
MainFunc::usage=" ";
Begin["`Private`"];
$MaxExtraPrecision=\[Infinity];
MainFunc[H_,L_]:=Module[{},
Quiet[LaunchKernels[]];
DimenScales=CreateDialog[Row[{Style["        Variables   \n",18,Black],
Row[{Style["   \n       H= 
 ",14,Blue],Style[ToString[N[H],TraditionalForm],14,Black],Style["  \n          
",14,Red]}],
Row[{Style["   \n       L= 
",14,Blue],Style[ToString[N[L],TraditionalForm],14,Black],Style["  \n          
",14,Red]}]
 }]];

Tplot3DINI=Plot3D[Sin[x*z],{x,0,L},{z,0,H},ImageSize->Medium];
TplotConINI=ContourPlot[Sin[x*z],{x,0,L},{z,0,H},ImageSize->Medium];

 T3DplotDialog3D=CreateDialog[Grid[{{Row[{Style["         FIELD 
 \n",15,Red]
 }]},{Tplot3DINI}}],Background->White];

 T3DplotDialogCon=CreateDialog[Grid[{{Row[{Style["          FIELD 
  \n",15,Red]
  }]},{TplotConINI}}],Background->White];

  Pause[5];
  NotebookClose[DimenScales];
  NotebookClose[T3DplotDialog3D];
  NotebookClose[T3DplotDialogCon];
  ];

  SetAttributes[MainFunc,{HoldAll}];
  End[];
  EndPackage[];

I saved two version of cdf file; one with the code of the interface visible (GUITrialv1cdf.cdf) and without one (GUITrialv2cdf.cdf).

POSTED BY: Erdem Uguz
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract