Inconsistent code javascript interpretation ??? or ...?

aworonow

Well-known member
Here are a few lines of code that respond differently:
Line 893 opens a new image view with the id BO_mix
Line 902 changes the id of GView to Go_mix
(The test cause I use has no entry for OView...that is, OView remains is undefined from the parameters list on.)

Below the code are the declarations for the images
Also note that the Console write gives the correct id for the source image of the viewById function, and I have tried moving the code to a different place as well as checking that everywhere in the code GO has the letter O, and not the number zero. HELP!!! Except for this I'm done with my first 1000 lines of working javascript code!

1611438338313.png


1611438629524.png



Thanks in advance, Alex
 
Hi Alex,

I need to see more code, including your Narrowband_into_Broadband function, to really help you. Also please copy source code in forum posts instead of screen shots, which are very difficult to use. You can include a code fragment in a post very easily ( click the button with ... and a down arrow, then select "</> Code").

Just something I've detected in the images you've posted. If you first define OView as undefined, then the OView.id property does not exist. Also take into account that you should qualify OView as a property of some object of BlendParameters type, so for example, one would expect to have something like:

myBlendParameters.OView
 
Thanks Juan, I've attached the current code...a work in progress! As I said, it only happens for OView, not for the other views. If you have a chance, I'm also struggling with the code surrounding my function SaveParameters and today's project is figuring out how to interact with the checkbox. Other than that stuff, most of it appears to be working, but whatever you can suggest is Extremely Appreciated! As I said, this is my first every attempt at JavaScript and at a PI script. (I intend to make it prettier when it's really running!)

Thanks, Alex
 

Attachments

  • RGBSHO True Color v0-0-4.zip
    8.3 KB · Views: 50
Update: I have almost everything working. The 1st problem was circumvented by using PM, and the only thing left to get going is saving/restoring parameters when an instance is generated...if someone knows a good source of code to copy...one that is not too involved...that might work!

Thanks, Alex
 
It's covered in the recent scripting video in this link from the Forum (sorry, not sure how properly to post a link to another message thread)

Gordon
 
Thanks Gordon. I participated in that webinar, and that's what motivated me to if it all a try. But there are things it doesn't cover, like how to save an instance that contains an image reference (like to a red-filter view) and how to reload it when you click the instance icon then double click the circle to reopen the dialog. I cannot get the images I selected in the viewselector to be present.

But thanks for the fine reference.
a
 
Back
Top