Runtime error Value ((non-coercible)) has wrong type (gnu.lists.PairWithPosition

480 views
Skip to first unread message

Akil

unread,
Jun 9, 2016, 4:07:31 PM6/9/16
to MIT App Inventor Forum
Hi App Inventors, 

I am building a simple tool that generates RGB values for custom colors using sliders. 
For a closer look, it is published in the AI2 gallery - ai2.appinventor.mit.edu/?galleryId=5410470792265728  

Keep getting this vexing runtime error:
Value ((non-coercible)) has wrong type (gnu.lists.PairWithPosition) (expected: real) Note: You will not see another error reported for 5 seconds.

Not sure what is triggering the error. During debugging using the AI2 companion, the error only occurs when a slider is first touched. After the error message is displayed, the app works properly, but only during debugging. However if the .apk is downloaded, the app closes after the error message is displayed 

I suspect it has to do with the MaxValue, MinValue and ThumbPosition properties of the sliders and rounding off the thumbPosition to whole numbers in the blocks.

Here are screenshots of the blocks, and the slider properties and the working app - 

 


Is my logic faulty? Any help would be greatly appreciated because I plan to use it as a teaching tool in my workshops.


- Akil

Taifun

unread,
Jun 9, 2016, 4:46:13 PM6/9/16
to MIT App Inventor Forum
do not set the thumbPosition like this!
try to remove that row and I think, it then should work (well, it's just a guess)


Taifun

Trying to push the limits of App Inventor! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun. 

Taifun

unread,
Jun 9, 2016, 4:47:18 PM6/9/16
to MIT App Inventor Forum
if you want to round, then do it like this
set redLabel.Text to round thumbPosition

Taifun

Taifun

unread,
Jun 9, 2016, 4:49:03 PM6/9/16
to MIT App Inventor Forum
also to avoid redundancy, use a procedure, see also http://twodogapps.com/?page_id=686#Procedures and call the procedure from each of the PositionChanged events
Taifun
Reply all
Reply to author
Forward
0 new messages