Simple coding question

aworonow

Well-known member
Hello all,
I save off views using the set command:

Parameters.set("RView", RView.id);

and drag off an instance. Then, double click the instance to bring up the window that has the values (and the view is listed there), then click the circle and the dialog appears, but without the retrieved view in the viewlist. I retrieve the view using

if (Parameters.has("RView")) {
AugmentParameters.RView = View.viewById(Parameters.getString("RView"));

I check using Console.writeln that it has RView.id and it appears fine. But I want this view to show in the viewlist dialog box so I tried about everything I could think of....here is one example of what I tried...

AugmentParameters.RViewList.currentView = AugmentParameters.RView;

I have tried declaring RVList globally (as in the code below) and not declaring it globally among about 50 variations of everything I can think of, but I haven't found the correct way to do this?

Thanks for your help...Alex






Code:
var AugmentParameters = {
   filterWidthBB: 90.0,
   filterWidthNB: 5.0,
   exposureBB: 300,
   exposureNB: 1800,
   HFactor: 2.0,
   SFactor: 2.0,
   OFactor: 2.0,
   HbPcnt: 34.0,  // supposedly the commonly assumed value Ha/Hb=3.92
   OBPcnt: 50.0,   // very close to the true value
   HView: undefined,
   SView: undefined,
   OView: undefined,
   RView: undefined,
   GView: undefined,
   BView: undefined,
   GO_amp: "",
   BHO_amp: "",
   RHS_amp: "",
   SHO_RGB: "",
   Ha_LINE: "",
   SII_LINE: "",
   OIII_LINE: "",
   dialog: "",
   RViewList: "",

   // save parameters for new instance
   save: function () {

      with ( AugmentParameters ) {
         Parameters.set( "filterWidthBB", filterWidthBB );
         Parameters.set( "filterWidthNB", filterWidthNB );
         Parameters.set( "exposureBB", exposureBB );
         Parameters.set( "exposureNB", exposureNB );
         Parameters.set( "HFactor", HFactor );
         Parameters.set( "SFactor", SFactor );
         Parameters.set( "OFactor", OFactor );
         Parameters.set( "HbPcnt", HbPcnt );
         Parameters.set( "ProcessingOption", ProcessingOption);
         Parameters.set( "DeleteIntermediate", DeleteIntermediate );
         Parameters.set( "OBPcnt", OBPcnt );
         /*
         Parameters.set( "HView", HView.id );
         Parameters.set( "SView", SView.id );
         Parameters.set( "OView", OView.id );
         Parameters.set( "RView", RView.id );
         Parameters.set( "GView", GView.id );
         Parameters.set( "BView", BView.id );
         */
         Parameters.set("RView", RView.id);
      }
   },

   // load the script instance parameters
   load: function() {

  //    with ( AugmentParameters ) {
         if (Parameters.has("exposureNB")) {
            AugmentParameters.exposureNB = Parameters.getReal("exposureNB"); }
         if (Parameters.has("exposureBB")) {
            AugmentParameters.exposureBB = Parameters.getReal("exposureBB"); }
         if (Parameters.has("filterWidthNB")) {
            AugmentParameters.filterWidthNB = Parameters.getReal("filterWidthNB"); }
         if (Parameters.has("filterWidthBB")) {
            AugmentParameters.filterWidthBB = Parameters.getReal("filterWidthBB"); }
         if (Parameters.has("HFactor")) {
            AugmentParameters.HFactor = Parameters.getReal("HFactor"); }
         if (Parameters.has("SFactor")) {
            AugmentParameters.SFactor = Parameters.getReal("SFactor"); }
         if (Parameters.has("OFactor")) {
            AugmentParameters.OFactor = Parameters.getReal("OFactor"); }
         if (Parameters.has("HbFactor")) {
            AugmentParameters.HbPcnt = Parameters.getReal("HbPcnt") }
         if (Parameters.has("OBPcnt")) {
            AugmentParameters.OBPcnt = Parameters.getReal("OBPcnt") }
         /*
         if (Parameters.has("HView")) {
            AugmentParameters.HView = Parameters.get("HView"); }
         if (Parameters.has("SView")) {
            AugmentParameters.SView = Parameters.get("SView"); }
         if (Parameters.has("OView")) {
            AugmentParameters.OView = Parameters.get("OView"); }
         if (Parameters.has("RView")) {
            AugmentParameters.RView = Parameters.get("RView"); }
         if (Parameters.has("GView")) {
            AugmentParameters.GView = Parameters.get("GView"); }
         if (Parameters.has("BView")) {
            AugmentParameters.BView = Parameters.get("BView"); }
         */
         if (Parameters.has("RView")) {
            AugmentParameters.RView = View.viewById(Parameters.getString("RView"));
            //HELP--THIS DOES NOT WORK! I've tried every syntext I can think of
            AugmentParameters.RViewList.currentView = AugmentParameters.RView;
         }
      }
   //}
};
AugmentParameters is the global declaration of the variables...I have attached the complete code that does these things.
 
Thanks, astroswell, I could not get that to work either. Maybe my problems go deeper. Maybe my issue is how does one prefix a ViewList from inside the parameters get area? Is it "this." or "Dialog." or "AugmentParameters." or something else? Or should the work of putting the view back in the dialog be done somewhere else all together?
a
 
Thanks, astroswell, I could not get that to work either. Maybe my problems go deeper. Maybe my issue is how does one prefix a ViewList from inside the parameters get area? Is it "this." or "Dialog." or "AugmentParameters." or something else? Or should the work of putting the view back in the dialog be done somewhere else all together?
a
Just checked on my side, works if currentView is set after getAll() call.
If you share a full source I can take a look and try to figure out
 
I've attached it all...I tried putting it in at line 170-171. The idea is, I want folks to be able to drag off an instance icon after they have set the parameters so they can open it (double click then click the circle in the window that opens), and try variations on parameters without having to re-enter everything.
Your help is very greatly appreciated!!!!.
Alex
 

Attachments

  • Narrowband-Augmented RGB v0-0-21b.zip
    9.2 KB · Views: 52
I've attached it all...I tried putting it in at line 170-171. The idea is, I want folks to be able to drag off an instance icon after they have set the parameters so they can open it (double click then click the circle in the window that opens), and try variations on parameters without having to re-enter everything.
Your help is very greatly appreciated!!!!.
Alex

Line 207
Code:
// instead of
   trueColorData.RView = this.RViewList.currentView;

// should be
   if (trueColorData.RView) {
      this.RViewList.currentView = trueColorData.RView
   }

You had inverted assignment, instead of setting List's currentView you were overriding what you had in trueColorData.RView variable with the List's currentView which is empty at that moment :)
 
Thanks a ton! I got it working using your code. You have no idea how many hours I spent looking in the wrong places! Thanks, Again!
Alex
 
Back
Top