DropDown
element
since
PennController 1.2description
Represents a drop-down list.
syntax
newDropDown("ELEMENT_NAME","DEFAULT_TEXT")
-
"ELEMENT_NAME"
: The name of the newly-created element. -
"DEFAULT_TEXT"
: To be filled in.
note(s)
- By default, a DropDown element does not have any options. To add options, use the command
dropdown.add
. - The
"DEFAULT_TEXT"
string parameter does not create a drop-down list option.
example
newTrial("option-1",
newText("like", "I like ")
,
newDropDown("fruits", "(select a fruit)")
.add("apples", "bananas", "oranges")
.before(getText("like"))
.print()
)
newTrial("option-2",
newDropDown("fruits", "(select a fruit)")
.add("apples", "bananas", "oranges")
,
newText("like", "I like ")
.after(getDropDown("fruits"))
.print()
)
Action commands
dropdown.add
syntax
getDropDown(“ELEMENT_NAME”).add()
description
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
example
click to expand
// example
dropdown.callback
syntax
getDropDown(“ELEMENT_NAME”).callback()
description
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
example
click to expand
// example
dropdown.log
syntax
getDropDown(“ELEMENT_NAME”).log()
description
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
example
click to expand
// example
dropdown.once
syntax
getDropDown(“ELEMENT_NAME”).once()
description
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
example
click to expand
// example
dropdown.remove
syntax
getDropDown(“ELEMENT_NAME”).remove()
description
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
example
click to expand
// example
dropdown.select
syntax
getDropDown(“ELEMENT_NAME”).select()
description
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
example
click to expand
// example
dropdown.shuffle
syntax
getDropDown(“ELEMENT_NAME”).shuffle()
description
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
example
click to expand
// example
dropdown.wait
syntax
getDropDown(“ELEMENT_NAME”).wait()
description
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
example
click to expand
// example
standard.after
syntax
getX(“ELEMENT_NAME”).after(getX(“ARGUMENT_NAME”))
description
Takes an element as an argument, and adds that element’s content to the right of the element that the command is called on.
example
click to expand
@// Option 1: Pass a new element as an argument
@newTrial("option-1",
@ newText("center", "BANANA")
@ .before(newText("left", "apple"))
$ .after(newText("right", "orange"))
@ .print()
@)
@
@// Option 2: Pass an existing element as an argument
@newTrial("option-2",
@ newText("left", "apple")
@ ,
@ newText("right", "orange")
@ ,
@ newText("center", "BANANA")
@ .before(getText("left"))
$ .after(getText("right"))
@ .print()
@)
↳ Prints appleBANANAorange
to the screen.
standard.before
syntax
getX(“ELEMENT_NAME”).before(getX(“ARGUMENT_NAME”))
description
Takes an element as an argument, and adds that element’s content to the left of the element that the command is called on.
example
click to expand
@// Option 1: Pass a new element as an argument
@newTrial("option-1",
@ newText("center", "BANANA")
$ .before(newText("left", "apple"))
@ .after(newText("right", "orange"))
@ .print()
@)
@
@// Option 2: Pass an existing element as an argument
@newTrial("option-2",
@ newText("left", "apple")
@ ,
@ newText("right", "orange")
@ ,
@ newText("center", "BANANA")
$ .before(getText("left"))
@ .after(getText("right"))
@ .print()
@)
↳ Prints appleBANANAorange
to the screen.
standard.bold
syntax
getX(“ELEMENT_NAME”).bold()
description
Bolds any text that appears in the element.
example
click to expand
@newText("bolded-text", "Hello, text!")
$ .bold()
@ .print()
*,
@newButton("bolded-button", "Hello, button!")
$ .bold()
@ .print()
↳ Prints Hello, text!
in bold, then prints a button that says Hello, button!
in bold on a new line.
standard.center
syntax
getX(“ELEMENT_NAME”).center()
description
Horizontally centers the element.
example
click to expand
@newButton("centered-button", "Hello, button!")
$ .center()
@ .print()
↳ Prints a horizontally centered button that says Hello, button!
.
standard.css
syntax
getX(“ELEMENT_NAME”).css(“CSS_PROPERTY”, “VALUE”)
description
Applies the specified CSS property and value pair to the element.
example
click to expand
@newText("framed-text", "Hello, text!")
$ .css("border", "solid 1px red")
@ .print()
*,
@newButton("orchid-smallcaps-button", "Hello, button!")
$ .css({"background-color":"orchid", "font-variant":"small-caps"})
@ .print()
↳ Prints Hello, text!
surrounded by a 1px solid red border. On a new line, prints a button with an orchid background color that says Hello, button!
in small caps.
optional parameters
-
getX(“ELEMENT_NAME”).css({“CSS_PROPERTY_1”:”VALUE_1”, “CSS_PROPERTY_2”:”VALUE_2”})
standard.cssContainer
syntax
getX(“ELEMENT_NAME”).cssContainer(“CSS_PROPERTY”, “VALUE”)
description
Applies the specified CSS property and value pair to the container of the element.
example
click to expand
newText("center", "BANANA")
.before(newText("left", "apple"))
.after(newText("right", "orange"))
.css("color", "red")
.cssContainer("background-color", "aqua")
.print()
↳ Prints appleBANANAorange
to the screen. The substring BANANA
has a red text color, and the entire string has an aqua background color.
optional parameters
-
getX(“ELEMENT_NAME”).cssContainer({“CSS_PROPERTY_1”:”VALUE_1”, “CSS_PROPERTY_2”:”VALUE_2”})
standard.disable
syntax
getX(“ELEMENT_NAME”).disable()
description
Disables any interactive feature of the element.
example
click to expand
@// example
standard.enable
syntax
getX(“ELEMENT_NAME”).enable()
description
Enables any interactive feature that was previously disabled.
example
click to expand
// example
standard.hidden
standard.left
syntax
getX(“ELEMENT_NAME”).left()
description
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
example
click to expand
// example
standard.print
syntax
getX(“ELEMENT_NAME”).print()
description
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
example
click to expand
// example
standard.refresh
syntax
getX(“ELEMENT_NAME”).refresh()
description
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
example
click to expand
// example
standard.remove
syntax
getX(“ELEMENT_NAME”).remove()
description
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
example
click to expand
// example
standard.right
syntax
getX(“ELEMENT_NAME”).right()
description
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
example
click to expand
// example
standard.scaling
syntax
getX(“ELEMENT_NAME”).scaling()
description
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
example
click to expand
// example
that zooms an element in/out to fit the argument(s), which can be: a ratio (with 1 for 100%), a unit dimension (eg. “10vw”), or the page/screen (pass "page"
)
standard.selector
syntax
getX(“ELEMENT_NAME”).selector()
description
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
example
click to expand
// example
standard.setVar
syntax
getX(“ELEMENT_NAME”).setVar()
description
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
example
click to expand
// example
standard.size
syntax
getX(“ELEMENT_NAME”).size()
description
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
example
click to expand
// example
standard.visible
syntax
getX(“ELEMENT_NAME”).visible()
description
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
example
click to expand
@newText("hidden-text", "Surprise!")
@ .hidden()
@ .print()
*,
@newButton("reveal", "Click to reveal a surprise")
@ .print()
@ .wait()
*,
@getText("hidden-text")
$ .visible()
↳ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Test commands
dropdown.test.selected
syntax
getDropDown(“ELEMENT_NAME”).test.selected()
description
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
example
click to expand
// example
standard.test.printed
syntax
getX(“ELEMENT_NAME”).test.printed()
description
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
example
click to expand
// example