PennController for IBEX › Forums › Support › Umlaut, opening link in new tab, select option key or click
Tagged: hyperlink, letters, mouse click, new tab, selector
- This topic has 4 replies, 2 voices, and was last updated 3 years, 4 months ago by Jeremy.
January 28, 2020 at 5:18 pm #4674
For a university project, we’re working on an experiment and I have encountered three problems for which I have yet not found any solutions:
2. When creating a hyperlink for a document to read prior to the experiment (with
<a>), clicking on it in the experiment leads to loading the link on the current tab (and a warning that the experiment is not finished or so). How can I code that the link will automatically open in a new tab upon clicking?
3. In the experiment, each trial we first show a sentence, then another sentence and then a question with a ‘continue’ button. after each sentence and for the button it would be nice to have the option of letting participants proceed by either pressing the space bar or a mouse click. I figure I have to use a Selector to select between newKey and a mouse click, but what is the coding for that mouse click and how do I apply this to the button?
Thank you very much in advance!
January 28, 2020 at 5:21 pm #4675
- This topic was modified 3 years, 4 months ago by Jeremy. Reason: made the A tag visible
In the brackets before the hyperlink starts I put the code for that with ‘a’ and so on. So you can ignore the link, it doesn’t do anything anyways.January 28, 2020 at 5:33 pm #4677JeremyKeymaster
1. Using HTML codes, as you mention, is probably the solution that is best in terms of cross-browser compatibility. You can find a useful table here: https://www.starr.net/is/type/htmlcodes.html
An example of a script:
PennController( newButton("grüßen") .print() .wait() )
This is of course not ideal in terms of readability from the experimenter’s end. Another solution is to save your script using an UTF8 encoding. In order to do that, you need to edit your script file on your local device (using your own text editor) and make sure to save it with a UTF8 encoding, and then upload your script file back to your project. Note that opening the online editor and clicking “Save” will fall back to the old, non-UTF8 format, so you need to keep editing the file locally and uploading it later.
2. You want to use the
targetattribute with the value
'_blank', like this:
<a href='https://expt.pcibex.net/' target='_blank'>Open the PCIbex Farm</a>
3. You are right, you need to use a Selector element, but then you no longer need a Key element:
newButton("continue", "Continue") .print() , newSelector("next") .settings.add( getButton("continue") ) .settings.keys( " " ) .wait()
Let me know if you still have questions
JeremyJanuary 29, 2020 at 11:39 am #4683
thank you very much for the help so far. I successfully applied everything.
I have one follow-up question to question 3:
How do i apply that choice to proceed by either space bar or a click anywhere on the window between two lines of text? So I want to print one text and before printing the next one the participant right now has to press any key, but adding the option of a mouse click would be convenient.
AkiraJanuary 29, 2020 at 12:09 pm #4685JeremyKeymaster
Giving the option to click anywhere on the screen is a little tricky in PennController: you need to create a Canvas that covers the entire surface o the window. Note that this will likely prevent any interactions with elements on the page until the Canvas is removed (which you should be fine with, in your case). Here’s an example:
newText("instructions", "Please click anywhere on the screen or press the spacebar") .print() , newCanvas("screen", "100vw", "100vh") .print("center at 50vw", "center at 50vh") , newSelector("continue") .settings.add(getCanvas("screen")) .settings.keys( " " ) .wait() , getText("instructions").remove(), getCanvas("screen").remove() , newText("thanks", "Thank you!") .print()
Let me know if you have questions
- You must be logged in to reply to this topic.