I have two plot files. In one of them (created a couple of days ago) I’ve added Notes to certain elements, and the note text is available to my demo application’s actions. I created another plot this morning, and also added notes to some elements, but in the corresponding demo, they all show up as empty strings (because they are not being added to the objects passed to the element constructors.
I suspect I am doing something different in the newer plot file that’s causing the notes to not appear, but I cannot figure out what that “something different” might be.
Any ideas?
Here’s a screen shot of the ForeUI tools pane, next to the generated JavaScript for an element from my older plot, which was generated correctly:
And here’s the same pair of windows for an element from today’s plot that wasn’t generated correctly:
3 answers
The note will be included in HTML5 simulation only when it is referred in behavior definition.
For example, you define a button, when click the button, a message window will show up and display the “Note” of the button. In this case the note will be generated. Otherwise, if nobody uses the note, it will not be included in the simulation.
This implement is to avoid adding too much (unnecessary) data into the simulation.
Hi ViVi,
Thanks for your response, but actually, the way I discovered this issue was that I did have a reference to the note property in a behavior definition, and the behavior didn’t work as I expected. (I probably would not have gone looking for the definition of the ImageBox parameters object if it had not been for that.)
I’m attaching another example that shows a bit more context. I have put three ImageBoxes on my plot, and I have given each one an onClick behavior to set the value of the custom property “WhichOne” from the value of that ImageBox’s “note” property. As you can see, there has been a click on ImageBox_1, but the value of WhichOne is still the empty string.
This is because the call to getProperty(“ImageBox_1.note”) has returned the empty string, which it will do if the “note” property is absent from the ImageBox’s _params object — which you can see is the case in the JavaScript window at lower left.
There is one obvious difference — which I hadn’t noticed before — between this plot and the one I mentioned earlier that works:
- In this plot, I am merely attempting to read the value of the note property, and copy that value to the custom property; the corresponding JavaScript statement is: setCustomProperty(“WhichOne”, getProperty(“ImageBox_1.note”), 1)
- In the plot that works, what I am doing is using the value of the note property as the name of a custom property. That is, I have an action definition that reads “Set {{ImageBox_Sort2.note}} Property to Value 0” in the behavior editor; and the corresponding JavaScript statement is: setCustomProperty(getProperty(“ImageBox_Sort2.note”), 0, 0);
It’s still possible that I’m doing something wrong in the example shown below. But because there’s a call to getProperty(“elementName_N.note”) in each case, it does seem suspicious that there’s an actual “note” property in the _params object in only one of those two cases.
Hi Hephaestus,
After debugging we confirm it is a bug, which will happen when you place the note property into an expression in EVAL mode. We will fix it in next version, meanwhile you can workaround it by setting the expression to TEXT mode.
By default the property value field is in EVAL mode (with blue “EVAL” icon on the right), and it will add “” to the property name, which is not recognized when counting the note reference. You can click that blue “EVAL” icon and change it to green “TEXT” icon, thus you should be able to workaround this bug.