Difference between revisions of "Conditional Visibility"

From GeoGebra Manual
Jump to: navigation, search
m (Text replace - "<div class="box info"> 48px|left This page is part of the official manual for print and pdf. For structural reasons normal users can't edit this page. If you found any errors on this page please contact )
(added interlink.)
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<noinclude>{{Manual Page|version=4.2}}</noinclude>
+
<noinclude>{{Manual Page|version=5.0}}</noinclude>{{objects|advanced}}
{{objects|advanced}}
+
Apart from just showing or hiding certain objects you can also have their visibility status depend on a certain condition. For example, you would like an object to appear on screen if you check a checkbox positioned in the [[File:Menu view graphics.svg|link=|16px]] [[Graphics View]] or if a [[Slider Tool|slider]] is changed to a certain value.
Apart from just showing or hiding certain objects you can also have their visibility status depend on a certain condition. For example, you would like an object to appear on screen if you check a checkbox positioned in the [[Graphics View]] or if a [[Slider Tool|slider]] is changed to a certain value.
 
  
 
==Conditionally Show or Hide Existing Objects==
 
==Conditionally Show or Hide Existing Objects==
  
You can use the [[Image:Tool Check Box to Show Hide Objects.gif]] [[Check Box to Show/Hide Objects Tool]] in order to create a checkbox that controls the visibility of one or more existing objects on screen.  
+
You can use the [[File:Mode showcheckbox.svg|link=|24px]] [[Check Box Tool]] in order to create a checkbox that controls the visibility of one or more existing objects on screen.  
  
Alternatively, you could also create a [[Boolean values|Boolean variable]] (e. g., <code>b = true</code>) using the [[Input Bar]] and make it visible as a checkbox in the [[Graphics View]] by changing its visibility status (e. g., use  [[Image:Tool_Show_Hide_Object.gif]] [[Show / Hide Object Tool]] or the [[Context Menu]]). In order to use this Boolean variable as a condition for the visibility of certain objects, you need to follow the steps described below.
+
Alternatively, you could also create a [[Boolean values|Boolean variable]] (e.g. <code>b = true</code>) using the [[Input Bar]] and make it visible as a checkbox in the [[File:Menu view graphics.svg|link=|16px]] ''Graphics View'' by changing its visibility status (e.g. use  [[File:Mode showhideobject.svg|link=|24px]] [[Show / Hide Object Tool]] or the [[Context Menu]]). A checkbox therefore is a visible ''Boolean variable''.
 +
In order to use this Boolean variable as a condition for the visibility of certain objects, you need to follow the steps described below.
  
 
==Changing the Visibility of Newly Created Objects==
 
==Changing the Visibility of Newly Created Objects==
In the [[Properties Dialog]], you can enter a condition for the visibility of an object on tab Advanced.
+
In the [[File:Menu-options.svg|link=|16px]] [[Properties Dialog]], you can enter a condition for the visibility of an object on tab ''Advanced''.
{{note|You can select the logic operators (e. g., ≠, ≥, ˄, ‖) from the drop down list in order to create your conditional statements.}}
+
{{note|You can select the [[Boolean values#Operations|logic operators]] (e.g. ≠, ≥, ˄, ‖) from list to the right of the input field in order to create your conditional statements.}}
 
{{example|
 
{{example|
* If a is a slider, then the conditional statement a < 2 means that the corresponding object is only shown in the Graphics View if the slider value is less than 2.
+
* If a is a slider, then the conditional statement a < 2 means that the corresponding object is only shown in the [[File:Menu view graphics.svg|link=|16px]] ''Graphics View'' if the slider value is less than 2.
 
* If b is a Boolean variable, you can use b as a conditional statement. The corresponding object is shown whenever the value of b is true and is hidden when the value of b is false.
 
* If b is a Boolean variable, you can use b as a conditional statement. The corresponding object is shown whenever the value of b is true and is hidden when the value of b is false.
 
* If g and h are two lines and you would like a text to be shown whenever these lines are parallel, then you could use g ‖ h as a conditional statement for the text.}}
 
* If g and h are two lines and you would like a text to be shown whenever these lines are parallel, then you could use g ‖ h as a conditional statement for the text.}}
 
{{Note|1=See also [[SetVisibleInView Command|SetVisibleInView]] command.}}
 
{{Note|1=See also [[SetVisibleInView Command|SetVisibleInView]] command.}}

Latest revision as of 11:59, 18 August 2022


Apart from just showing or hiding certain objects you can also have their visibility status depend on a certain condition. For example, you would like an object to appear on screen if you check a checkbox positioned in the Menu view graphics.svg Graphics View or if a slider is changed to a certain value.

Conditionally Show or Hide Existing Objects

You can use the Mode showcheckbox.svg Check Box Tool in order to create a checkbox that controls the visibility of one or more existing objects on screen.

Alternatively, you could also create a Boolean variable (e.g. b = true) using the Input Bar and make it visible as a checkbox in the Menu view graphics.svg Graphics View by changing its visibility status (e.g. use Mode showhideobject.svg Show / Hide Object Tool or the Context Menu). A checkbox therefore is a visible Boolean variable. In order to use this Boolean variable as a condition for the visibility of certain objects, you need to follow the steps described below.

Changing the Visibility of Newly Created Objects

In the Menu-options.svg Properties Dialog, you can enter a condition for the visibility of an object on tab Advanced.

Note: You can select the logic operators (e.g. ≠, ≥, ˄, ‖) from list to the right of the input field in order to create your conditional statements.
Example:
  • If a is a slider, then the conditional statement a < 2 means that the corresponding object is only shown in the Menu view graphics.svg Graphics View if the slider value is less than 2.
  • If b is a Boolean variable, you can use b as a conditional statement. The corresponding object is shown whenever the value of b is true and is hidden when the value of b is false.
  • If g and h are two lines and you would like a text to be shown whenever these lines are parallel, then you could use g ‖ h as a conditional statement for the text.
Note: See also SetVisibleInView command.
© 2024 International GeoGebra Institute