2 Improved formatting
source | link

I have been working on my senior project that involves the creation of a CDF with multiple "Manipulate" objectsManipulateexpressions. I need to protect my code so I have been trying to create/encode a package that will run the program. I have gotten the program to work flawlessly as a notebook in MMA, but as a CDF I get shadowing errors. I have 54 functions in the code and many of my functions use the same variables which are changed by the user input. I have tried to put all of the code in a single package then set the initialization of each Manipulate functionManipulate to the same package, but I get errors. It seems like I need to have a package for each Manipulate objectManipulate, then have a function at the beginning of the program to call each package... I am not sure. Here is a scaled-down version.

    Manipulate[dummyFunctionToDefineNullSet[], 
  Initialization :> (
       SuccessfulShotsFor = {};
       )]

  <someManipulateObject>  

    Manipulate[iSSF[], 
     Initialization :> (
    iSSF[] := 
     (PopupWindow[
          Button[Style[SomeStyle], , Background -> SomeBackground], 
          Button[
            (ptevent0 := (If[
                Extract[#(If[Extract[#, {1}] < 575, {1150, 740} - #, #]) &;
              Show[Image, ImageSize -> {1150, 740}]), 
            AppendTo[SuccessfulShotsFor, 
            ptevent0[MousePosition["Graphics"]]], 
            Appearance -> Frameless], 
          WindowTitle -> "Successful Shots For", WindowFrame -> "Normal", 
          Background -> RGBColor[51/240, 163/240, 220/240], 
          Editable -> False, TextAlignment -> Center , 
          WindowSize -> {1200, 825}, WindowFloating -> False, 
          WindowMargins -> {{0, Automatic}, {Automatic, 0}}]))]

Manipulate[Quiet[dSSF[SuccessfulShotsFor]]
<someManipulateObject>

Manipulate[
 Quiet[dSSF[SuccessfulShotsFor]], 
 Initialization :> (
   dSSF[
     SuccessfulShotsFor_] := 
       (Check[
          ImageCompose[
       SmoothDensityHistogram[ SuccessfulShotsFor    SmoothDensityHistogram[SuccessfulShotsFor, 
              AspectRatio -> Full, PlotRange -> {{0, 1150}, {0, 740}}, 
              ColorFunction -> "GreenPinkTones", Frame -> False, 
              PlotRangePadding -> 0, ImageSize -> {1150, 740}], 
            SomeImage], 
          "ERROR: no user input"]
Check[ImageCompose[        Check[
         ImageCompose[
           ListPlot[SuccessfulShotsFor, 
             AspectRatio -> Full, 
   PlotRange -> {{0, 1150}, {0, 740}}, 
             PlotMarkers -> {SomePlotMarker}, Frame -> False, 
             PlotRangePadding -> 0, ImageSize -> {1150, 740}, 
             Background -> RGBColor[0, 62/240, 5/240], Axes -> False], 
           SomeImage], 
         "ERROR: no user input"]))]

<someManipulateObject>

SuccessfulShotsForSuccessfulShotsFor has been giving me a ton of trouble. Once in a package, the value (which gets changed by the user input on the second Manipulate objectManipulate) takes on a different name which does not get passed on to the third ManipulateManipulate, which displays the images for the user to copy.

I am running these CDFs in MMAMathematica. I read about the $ContextPath$ContextPath, and I think that is the dealwhere the problem lies, but I am not experienced enough to implement itthe fix.

I have been working on my senior project that involves the creation of a CDF with multiple "Manipulate" objects. I need to protect my code so I have been trying to create/encode a package that will run the program. I have gotten the program to work flawlessly as a notebook in MMA, but as a CDF I get shadowing errors. I have 54 functions in the code and many of my functions use the same variables which are changed by the user input. I have tried to put all of the code in a single package then set the initialization of each Manipulate function to the same package, but I get errors. It seems like I need to have a package for each Manipulate object, then have a function at the beginning of the program to call each package... I am not sure. Here is a scaled version.

    Manipulate[dummyFunctionToDefineNullSet[], Initialization :> (
       SuccessfulShotsFor = {};
       )]

  <someManipulateObject>  

    Manipulate[iSSF[], 
     Initialization :> (iSSF[] := (PopupWindow[
          Button[Style[SomeStyle], , Background -> SomeBackground], 
          Button[(ptevent0 := (If[
                Extract[#, {1}] < 575, {1150, 740} - #, #]) &;
            Show[Image, ImageSize -> {1150, 740}]), 
           AppendTo[SuccessfulShotsFor, 
            ptevent0[MousePosition["Graphics"]]], 
           Appearance -> Frameless], 
          WindowTitle -> "Successful Shots For", WindowFrame -> "Normal", 
          Background -> RGBColor[51/240, 163/240, 220/240], 
          Editable -> False, TextAlignment -> Center , 
          WindowSize -> {1200, 825}, WindowFloating -> False, 
          WindowMargins -> {{0, Automatic}, {Automatic, 0}}]))]

Manipulate[Quiet[dSSF[SuccessfulShotsFor]], 
 Initialization :> (dSSF[
     SuccessfulShotsFor_] := (Check[
      ImageCompose[
       SmoothDensityHistogram[ SuccessfulShotsFor, 
        AspectRatio -> Full, PlotRange -> {{0, 1150}, {0, 740}}, 
        ColorFunction -> "GreenPinkTones", Frame -> False, 
        PlotRangePadding -> 0, ImageSize -> {1150, 740}], SomeImage], "ERROR: no user input"]
Check[ImageCompose[
  ListPlot[SuccessfulShotsFor, AspectRatio -> Full, 
   PlotRange -> {{0, 1150}, {0, 740}}, PlotMarkers -> {SomePlotMarker}, Frame -> False, 
   PlotRangePadding -> 0, ImageSize -> {1150, 740}, 
   Background -> RGBColor[0, 62/240, 5/240], Axes -> False], SomeImage], "ERROR: no user input"]))]

SuccessfulShotsFor has been giving me a ton of trouble. Once in a package, the value (which gets changed by the user input on the second Manipulate object) takes on a different name which does not get passed on to the third Manipulate which displays the images for the user to copy.

I am running these CDFs in MMA. I read about the $ContextPath and I think that is the deal, but I am not experienced enough to implement it.

I have been working on my senior project that involves the creation of a CDF with multiple Manipulateexpressions. I need to protect my code so I have been trying to create/encode a package that will run the program. I have gotten the program to work flawlessly as a notebook in MMA, but as a CDF I get shadowing errors. I have 54 functions in the code and many of my functions use the same variables which are changed by the user input. I have tried to put all of the code in a single package then set the initialization of each Manipulate to the same package, but I get errors. It seems like I need to have a package for each Manipulate, then have a function at the beginning of the program to call each package. I am not sure. Here is a scaled-down version.

Manipulate[dummyFunctionToDefineNullSet[], 
  Initialization :> (SuccessfulShotsFor = {};)]

<someManipulateObject>  

Manipulate[iSSF[], 
  Initialization :> (
    iSSF[] := 
     (PopupWindow[
          Button[Style[SomeStyle], , Background -> SomeBackground], 
          Button[
            (ptevent0 := 
              (If[Extract[#, {1}] < 575, {1150, 740} - #, #]) &;
              Show[Image, ImageSize -> {1150, 740}]), 
            AppendTo[SuccessfulShotsFor, ptevent0[MousePosition["Graphics"]]], 
            Appearance -> Frameless], 
        WindowTitle -> "Successful Shots For", WindowFrame -> "Normal", 
        Background -> RGBColor[51/240, 163/240, 220/240], 
        Editable -> False, TextAlignment -> Center , 
        WindowSize -> {1200, 825}, WindowFloating -> False, 
        WindowMargins -> {{0, Automatic}, {Automatic, 0}}]))]

<someManipulateObject>

Manipulate[
 Quiet[dSSF[SuccessfulShotsFor]], 
 Initialization :> (
   dSSF[
     SuccessfulShotsFor_] := 
       (Check[
          ImageCompose[
            SmoothDensityHistogram[SuccessfulShotsFor, 
              AspectRatio -> Full, PlotRange -> {{0, 1150}, {0, 740}}, 
              ColorFunction -> "GreenPinkTones", Frame -> False, 
              PlotRangePadding -> 0, ImageSize -> {1150, 740}], 
            SomeImage], 
          "ERROR: no user input"]
        Check[
         ImageCompose[
           ListPlot[SuccessfulShotsFor, 
             AspectRatio -> Full, PlotRange -> {{0, 1150}, {0, 740}}, 
             PlotMarkers -> {SomePlotMarker}, Frame -> False, 
             PlotRangePadding -> 0, ImageSize -> {1150, 740}, 
             Background -> RGBColor[0, 62/240, 5/240], Axes -> False], 
           SomeImage], 
         "ERROR: no user input"]))]

<someManipulateObject>

SuccessfulShotsFor has been giving me a ton of trouble. Once in a package, the value (which gets changed by the user input on the second Manipulate) takes on a different name which does not get passed on to the third Manipulate, which displays the images for the user to copy.

I am running these CDFs in Mathematica. I read about the $ContextPath, and I think that is the where the problem lies, but I am not experienced enough to implement the fix.

1
source | link

CDF with numerous independent manipulate objects

I have been working on my senior project that involves the creation of a CDF with multiple "Manipulate" objects. I need to protect my code so I have been trying to create/encode a package that will run the program. I have gotten the program to work flawlessly as a notebook in MMA, but as a CDF I get shadowing errors. I have 54 functions in the code and many of my functions use the same variables which are changed by the user input. I have tried to put all of the code in a single package then set the initialization of each Manipulate function to the same package, but I get errors. It seems like I need to have a package for each Manipulate object, then have a function at the beginning of the program to call each package... I am not sure. Here is a scaled version.

    Manipulate[dummyFunctionToDefineNullSet[], Initialization :> (
       SuccessfulShotsFor = {};
       )]

  <someManipulateObject>  

    Manipulate[iSSF[], 
     Initialization :> (iSSF[] := (PopupWindow[
          Button[Style[SomeStyle], , Background -> SomeBackground], 
          Button[(ptevent0 := (If[
                Extract[#, {1}] < 575, {1150, 740} - #, #]) &;
            Show[Image, ImageSize -> {1150, 740}]), 
           AppendTo[SuccessfulShotsFor, 
            ptevent0[MousePosition["Graphics"]]], 
           Appearance -> Frameless], 
          WindowTitle -> "Successful Shots For", WindowFrame -> "Normal", 
          Background -> RGBColor[51/240, 163/240, 220/240], 
          Editable -> False, TextAlignment -> Center , 
          WindowSize -> {1200, 825}, WindowFloating -> False, 
          WindowMargins -> {{0, Automatic}, {Automatic, 0}}]))]

Manipulate[Quiet[dSSF[SuccessfulShotsFor]], 
 Initialization :> (dSSF[
     SuccessfulShotsFor_] := (Check[
      ImageCompose[
       SmoothDensityHistogram[ SuccessfulShotsFor, 
        AspectRatio -> Full, PlotRange -> {{0, 1150}, {0, 740}}, 
        ColorFunction -> "GreenPinkTones", Frame -> False, 
        PlotRangePadding -> 0, ImageSize -> {1150, 740}], SomeImage], "ERROR: no user input"]
Check[ImageCompose[
  ListPlot[SuccessfulShotsFor, AspectRatio -> Full, 
   PlotRange -> {{0, 1150}, {0, 740}}, PlotMarkers -> {SomePlotMarker}, Frame -> False, 
   PlotRangePadding -> 0, ImageSize -> {1150, 740}, 
   Background -> RGBColor[0, 62/240, 5/240], Axes -> False], SomeImage], "ERROR: no user input"]))]

SuccessfulShotsFor has been giving me a ton of trouble. Once in a package, the value (which gets changed by the user input on the second Manipulate object) takes on a different name which does not get passed on to the third Manipulate which displays the images for the user to copy.

I am running these CDFs in MMA. I read about the $ContextPath and I think that is the deal, but I am not experienced enough to implement it.