It is quite simple to set a condition under which an object is displayed. This object can be a text, an image, a geometric object or any other object built with GeoGebra.
For example, in the applet shown here, as long as the calculation is false, the message “This is not the result” is displayed. It will be replaced by the message “Very good” when the result is correct.
Here are the steps for its creation:
Start by creating all the objects without worrying about which ones you want to display or not. Here, there are
You then have to enter the conditions to show the two texts that validate or not the answer.
For that, it is necessary to go to the properties of these objects and in the tab "Advanced," to enter the condition in the field "Condition to Show Object":
You have to type "Answer == 21"
You have to type "Answer != 21"
The file is now ready. Before saving, the algebra window must be closed: this prevents the students from easily finding/modifying the display conditions and it is more aesthetic...
It is also possible to change text color (or the color of any other object with a changeable color) according to the results given.
For example, in this applet, as long as the answer remains 0, the calculation is written in blue. If you enter a (different) wrong answer, it is written in red and it becomes green if the answer is right (and the message "Very good" appears).
To do this, you must use the "Dynamic colors", always in the "Advanced" tab of the properties:
Note that the logical AND is written as "∧" in GeoGebra (note that it is not a circumflex). To get it, you can type "&&" on the keyboard.
In GeoGebra version 5 you can use the symbol table of the software. The symbol table can be found at the end of the input line by clicking on "α").
In GeoGebra version 6 you can use the virtual keyboard.
Note on colors
The conditions used for the use of colors are logical tests: they take the value 0 or 1.
The colors are defined by a number between 0 and 1.
It is therefore possible to obtain shades of color by multiplying the tests by a number between 0 and 1, as shown here.
It is also possible to mix these 3 colors to obtain any color: to do this, you just need to assign them the same test. It is also possible to play on the opacity of an object.