getElement(id).settings.cssContainer(“styleName”, “style”) or getElement(id).settings.cssContainer({“style name 1”: “style 1”, “style name 2”: “style 2″}) Applies the CSS style(s) to the container’s element. This will affect both the element itself and any element wrapping it as added via or . This command often more closely accomplishes what you want to achieve than the command. Example: [js highlight=”4″ …
Wiki Category Archives:
standard.refresh
getElement(id).refresh() (since PennController 1.1) Calls the command again on the element, while leaving it where it was printed last. This command is primarily useful if some aesthetic command does not take effect unless print is called afterward, but you do not want to call print because calling it when you need the aesthetic command to …
standard.setVar
getElement(id).setVar( varName ) (since beta 0.3) Stores the current value of the element in the Var element named varName (if it exists). What the current value corresponds to is specific to each element type: For Audio elements, it corresponds to the timestamp of the end of the last playback so far (0 if never played …
standard.remove
getElement(id).remove() Removes the element from the screen. This has no effect for non-visual elements such as the purely interactive . Note that this leaves no space where the element previously was on the page (this is really removing the element, not just hiding it). Example [js highlight=”4″ try=”true”] newButton(“clickme”, “Click me”) .print() .wait() .remove() [/js] …
standard.test.printed
getElement(id).test.printed() (since beta 0.3) Tests whether the element was printed onto the page (and has not been removed since then). Example: [js highlight=”17-27″ try=”true”] newText(“instructions”, “Click on Top/Bottom to NOT print its word”) .print() , newButton(“top”, “Top”) .settings.callback( getButton(“top”).remove() ) .print() , newButton(“bottom”, “Bottom”) .settings.callback( getButton(“bottom”).remove() ) .print() , newButton(“print”, “Print the buttons’ words”) .print() …
standard.settings.visible
getElement(id).settings.visible() (since beta 0.3) Makes the element visible (again). This is useful if you previously hid the element with .settings.hidden. Example: [js highlight=”13″ try=”true”]newText(“instruction”, “Guess what fruit is in the image below”) .print() , newImage(“fruit”, “pear.png”) .settings.hidden() .print() , newButton(“reveal”, “Reveal fruit”) .print() .wait() , getImage(“fruit”) .settings.visible() [/js] Adds some text to the page, a …
standard.settings.size
getElement(id).settings.size(width, height) Resizes the element to a width of width pixels and a height of height pixels. Example: [js highlight=”2″ try=”true”]newImage(“smiley”, “pear.png”) .settings.size(40, 40) .print() [/js] Adds a 40x40px image pear.png onto the screen.
standard.settings.selector
getElement(id).settings.selector( selectorName ) or getElement(id).settings.selector( getSelector(selectorName) ) (since beta 0.3) Since beta 0.3, adds a .settings.selector command to all elements as another method for adding them to a selector. Example: [js highlight=”4,7″ try=”true”]newSelector(“shapes”) , newImage(“square”, “square.png”) .settings.selector(“shapes”) , newImage(“triangle”, “triangle.png”) .settings.selector(“shapes”) , newCanvas(“shapes canvas”, 825, 400) .settings.add( 0, 0, getImage(“square”) ) .settings.add(425, 0, getImage(“triangle”) ) …
standard.settings.right
getElement(id).settings.right() Makes the element appear horizontally aligned to the right. Note: the right means the right of the container of the element, not necessarily the right of the screen. Example: [js highlight=”5″ try=”true”] newText(“sentence”, “This is a longer sentence”) .print() , newText(“helloworld”, “Hello world”) .settings.right() .print() [/js] Prints Hello world onto the screen, horizontally aligned …
standard.settings.log
getElement(id).settings.log() Will add lines to the results file reporting element-specific events. See each Element page to see what gets recorded, and which parameter you can pass to log. For , and the results lines will report the timestamp corresponding to when print was called (if it was called). Example [js highlight=”6″] newButton(“go”, “Go!”) .print() .wait() …