Skip to content

BF: enable mouse clickable from variable online#6668

Merged
TEParsons merged 1 commit into
psychopy:devfrom
RebeccaHirst:_fixValidClickOnline
Jul 8, 2024
Merged

BF: enable mouse clickable from variable online#6668
TEParsons merged 1 commit into
psychopy:devfrom
RebeccaHirst:_fixValidClickOnline

Conversation

@RebeccaHirst

Copy link
Copy Markdown
Contributor

needed to add eval() so that a value from a spreadsheet (which is read in as a string) is instead converted to an object/variable name that can be clicked.

needed to add eval() so that a value from a spreadsheet (which is read in as a string) is instead converted to an object/variable name that can be clicked.
@RebeccaHirst RebeccaHirst requested a review from TEParsons July 4, 2024 14:17
@peircej

peircej commented Jul 4, 2024

Copy link
Copy Markdown
Member

@RebeccaHirst might this ever have the reverse problem? i.e. are there times when we don't want to evaluate (e.g. if it's not a variable?)

@RebeccaHirst

Copy link
Copy Markdown
Contributor Author

@peircej the clickable field of a mouse is always an object (e.g. polygon or image) I can't think of a situation where it makes sense for a string to be clickable, it would always throw an error.

@TEParsons

Copy link
Copy Markdown
Contributor

It would fail an eval if it were already an object handle though, so essentially whenever it isn't set via a spreadsheet. This could work though if you put it inside an if which checks whether it's a string before evaluating.

@TEParsons

Copy link
Copy Markdown
Contributor

Okay so, something I didn't know about JS, you can eval a list, object handle, etc. with no problem! It just returns as is. So yes, this is fine actually :)

@TEParsons TEParsons merged commit 0e02685 into psychopy:dev Jul 8, 2024
@peircej peircej added the 🐞 bug Issue describes a bug (crash or error) or undefined behavior. label Jul 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐞 bug Issue describes a bug (crash or error) or undefined behavior.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants