Hello, I am developing apps and deploying as CDF file. I would like to prevent user shift-enter and run the GUI to create second one. An example code is :
Get[FileNameJoin[{NotebookDirectory[EvaluationNotebook[]],
"DummyPackage.wl"}]];
Panel[DynamicModule[{np = 100, nd = 30, Res = 1.0},
Column[{Style["Random", "Function"] ,
Row[{"Digits ", InputField[Dynamic[nd]]}, Spacer[5]],
Row[{"Precision ", InputField[Dynamic[np]]}, Spacer[5]],
Button[Style["Calculate", Green, Bold],
Res = DummyPackage`myDummyF[nd, np], Method -> "Queued"],
Row[{Style["Result ", 12, Red],
InputField[Dynamic[Res], FieldSize -> 30, Enabled -> False]},
Spacer[15]]
}],
Initialization :> (
Get[FileNameJoin[{NotebookDirectory[EvaluationNotebook[]],
"DummyPackage.wl"}]];)]]
It is just random multiplication. And the package file is
BeginPackage["DummyPackage`"]
myDummyF[nd_,np_]:=Module[{mat,mat2,aI},
ns=200;
mat=SetAccuracy[RandomReal[{-100,100},ns],nd];
mat2=SetAccuracy[RandomReal[{-200,200},ns],nd];
d=0;
aI=ConstantArray[0,np];
SetSharedVariable[aI,d];
Time=AbsoluteTiming[
If[nd<=16,
Monitor[Do[
If[iC==2,Print["Do Loop"]];
aI[[iC]]=SetAccuracy[mat.(mat2/iC^0.5),nd],{iC,np}],ProgressIndicator[Dynamic[iC/np]]],
Monitor[ParallelDo[d++;
If[iC==2,Print[" ParallelDo Loop"]];
aI[[iC]]=SetAccuracy[mat.(mat2/iC^0.5),nd];
,{iC,np}],
ProgressIndicator[Dynamic[d/np]]]]];
Print["Do loop time = ",Time[[1]],", np = ",np,", nd = ",nd];
aInum=Apply[Plus,(aI/np)];
Print["Total = ",aInum];
Return[aInum]];
SetAttributes[{myDummyF},{ReadProtected,Protected,Locked}];
EndPackage[];
I create a cdf file using these two files and I get the cdf file in the attachment. In the CDF file I can shift-enter and create a second user interface. In the following CDF book example I can't do that and I wonder how that is done.
https://www.wolfram.com/cdf/uses-examples/textbooks.html