Welcome! Log In Create A New Profile

Advanced

place polygons where touch

Posted by lyt4 
place polygons where touch
December 14, 2019 03:38PM
Hi,
I am fairly new but have looked through all the premade adapters and don't seem to find something for this.
I'd like to allow a user to touch a position and have a polygon pop up there. E.g., you can touch a bunch on points on the screen and each time a polygon will appear at that location and stay there. I have tried reading touch_.XYData and using that to set the polygon's position, but that doesn't seem like the right thing to do.
Thanks!
Re: place polygons where touch
December 16, 2019 09:44PM
Try the attached task. You need to enable Touchscreen in the Non-DAQ Device Settings.

There is one thing you misunderstood. You can read touch_.XYData in the timing script, but you won't get any meaningful numbers. Adapters and adapter chains do something, only when they are executed by run_scene(). You need to write your own adapter and plug it in the chain, to access real-time data. The following is my answer to one of IVanegas's questions.

"You cannot access adapter properties on real time, unless you make your own adapters. What you can do in the timing script level is to set input properties, call run_scene() and check output properties after the scene ends. Basically you are interacting with adapters from their outside. The "real time" changes occur during run_scene() and you need to be inside the adapter to get property values that are changing from moment to moment."

The adapter template is in the ext directory of the NIMH ML installation path. Since your adapter requires graphics changes, you need to get yourself familiar with MGL. Refer to the attached TouchMarker adapter and the manual.

https://monkeylogic.nimh.nih.gov/docs_MonkeyLogicGraphicsLibrary.html
https://monkeylogic.nimh.nih.gov/docs_RuntimeFunctions.html#Trackers
https://monkeylogic.nimh.nih.gov/board/read.php?2,37,37#msg-37
https://monkeylogic.nimh.nih.gov/board/read.php?2,13,13#msg-13
Attachments:
open | download - touch_test.zip (2.3 KB)
Re: place polygons where touch
December 17, 2019 09:04PM
Thanks! that's very useful - I think I'm figuring it out.

The National Institute of Mental Health (NIMH) is part of the National Institutes of Health (NIH), a component of the U.S. Department of Health and Human Services.