Properties
Category
English
Due On
2021-03-02
Similar Topics
Statistics
Comments
4
Participants
3
Subscribers
3
Votes
1
Views
451
Share
Answered
Hi All --
Is it possible to link the display of captions to the value of a boolean variable?
I tried this -- in the Scripting Box for the object whose caption I wanted to display, I wrote If(ShowCaption==True, SetCaption(B, "hello"), SetCaption(B, "goodbye")) where B is a point and ShowCaption is a boolean. I got an "unbalanced bracket" error when I changed the value of the boolean. Not sure why.
Hopefully you can see my intention with the example. Any help figuring out how to do this would be much appreciated!
- GeoGebra
- Help
- Partners
-
Contact us
- Feedback & Questions
- This email address is being protected from spambots. You need JavaScript enabled to view it.
- +43 677 6137 2693
© 2023 International GeoGebra Institute
I think using the command SetLabel does the trick.
Try it the other way round:
or as you've foundThat exact command works for me on the current web version of Geogebra. Which version are you using?
Have you placed that script in the OnUpdate control of the boolean (ShowCaption)? If you put it in the script for B, then that doesn't explain the Unbalanced Brackets error but it will not work as expected, because the script won't trigger unless B is updated - which it won't be if you simply toggle the boolean.
Michael -- Thank you for the feedback! ShowLabel(B, ShowCaption) is much more compact than the If statement I was using.
pisquared -- It works now -- I can't explain why. User error I guess!
Comments have been locked on this page!