Difference between revisions of "Tutorial:Scripting: Mutually Exclusive Checkboxes"

From GeoGebra Manual
Jump to: navigation, search
m
Line 33: Line 33:
 
See: http://geogebrawiki.wikispaces.com/Radio+Buttons
 
See: http://geogebrawiki.wikispaces.com/Radio+Buttons
 
[[Category:Advanced tutorials]]
 
[[Category:Advanced tutorials]]
 +
 +
==Similar Ideas for other "buttons"==
 +
 +
<ggb_applet width="450" height="300"  version="4.0" ggbBase64="UEsDBBQACAAIAAuwLT8AAAAAAAAAAAAAAAAWAAAAZ2VvZ2VicmFfamF2YXNjcmlwdC5qc0srzUsuyczPU0hPT/LP88zLLNHQVKiu5QIAUEsHCEXM3l0aAAAAGAAAAFBLAwQUAAgACAALsC0/AAAAAAAAAAAAAAAADAAAAGdlb2dlYnJhLnhtbOVaW2/bRhZ+Tn/FAQsUu6glcS6k5FRKEQcoECBNCjgtihZ9GJIjiTXFUcmhLBf58XtmhqRI2bKl2Mi6u3Hk4XAOz/U7FyqZfr9dZbCRRZmqfOaRoe+BzGOVpPli5lV6Pph437/6arqQaiGjQsBcFSuhZx43lGky80LJzgkd00EoYzHgcRIOIi7EgI7nXAYBlyw49wC2ZfoyV+/FSpZrEcvLeClX4p2KhbaCl1qvX45G19fXw0bUUBWL0WIRDbdl4gGqmZczr754iex6D10zS059n4x+/fGdYz9I81KLPJYeGBOq9NVXL6bXaZ6oa7hOE71EM0I0YynTxdLYxCYejAzRGh2ylrFON7LERztba7NerT1LJnJz/sJdQdaa40GSbtJEFjPPHzLO+HhCQ38SngdhQJkHqkhlrmtiUgsdNeymm1ReO77myorkHmilskgYlvDpE4Sh+U196tcrqVfqVp/AmVmYW6hbuFsCDzZpmUaZnHlzkZXooTSfFxiddl/qm0xacfWNnXXkDFUu07+RGHl54FyKep35Z9y3H2dSR3/SkaiL6kSBjTgeHCmOnmKg02cnjjXiSDDpi6OHrAvvkefYH2Me6ZoX+Gf2r/3cksjus3Bf4r6BnyMw5F/ExOmoAf+0xjuUS0Nbg0bLVWkygJ1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Laklbyfkh1Nye+jFDO/zhoXsOOhQXvQoAehQU+EBn08NGyF/OLgoI8Ex0NxpMfD6MnAQT8THEEPHOwgONiJ4GD/VHCwLwaO4wvHgzB6ABzBZ4KD9LsKP4gOfiI6+D8VHfwZouP4ynEXjsSM3Gos/ejl1Qo9FbfBETZ4aGXVOLVxQi+g/fnwxDmBHBlP0gxtOBPaWQrfN9aOAeCrnnQDq64HdVgjQzvnd+a5jtnbdSFL801gF6sIMzxoUuI1zMBdwbcg8OM2TZ6MHsZ+8NwnKv9O5A/IcOz3/tC7MuEwjOyrVmvl6we8sHvzeIoC8GE+x5SwZoyt1oPwTiexx8LpzkLg3quNc39/feb307RzdnFGD5696Z1FM9J5hym7Ay/fL0yWiXlvdeoE3bu334nwTdiYvcutY+N58f8az8Mxu7gn1vvxpPvxpI+LJ70jnrdGxPvi+ea/Fc+Ji2fwHON5X376vXiy3WY/suzpI8tOa+DRfgMn/9MNPOw18A/Ob20Pjz6nh4fPvYffPb0OsKqEvR4eWCiy4WTSu82Oa+mRUpkUeWt2vA+sjh8eU0qO99WukJBx6Gyj97my+WIX5ulWJl1dOnVC5T+v3RdyycxatEtuOet+997NSXGa65Jn5DpKg6d3XXy866LTXCefk+vGX8J1yUHXxfuuG3W/abb/olP/94JX/wFQSwcI2/2afRsHAAD7IAAAUEsBAhQAFAAIAAgAC7AtP0XM3l0aAAAAGAAAABYAAAAAAAAAAAAAAAAAAAAAAGdlb2dlYnJhX2phdmFzY3JpcHQuanNQSwECFAAUAAgACAALsC0/2/2afRsHAAD7IAAADAAAAAAAAAAAAAAAAABeAAAAZ2VvZ2VicmEueG1sUEsFBgAAAAACAAIAfgAAALMHAAAAAA==" framePossible = "false" showResetIcon = "false" showAnimationButton = "true" enableRightClick = "false" errorDialogsActive = "true" enableLabelDrags = "false" showMenuBar = "false" showToolBar = "false" showToolBarHelp = "false" showAlgebraInput = "false" useBrowserForJS = "true" allowRescaling = "true" />
 +
* Made by Slik - see [http://www.geogebra.org/forum/viewtopic.php?p=78222#p78222 Forum]

Revision as of 21:00, 13 September 2011

Tutorial: Mutually Exclusive Checkboxes

In this tutorial we will show how to create three checkboxes, exactly one of which is always checked. This construction uses Scripting. We will use GGBScript as it is more suitable for simple scripts.

1 Create three checkboxes, a,b and c.

2 Right-click checkbox a, open the Properties Dialog and in Scripting tab (OnUpdate), enter following script to the text area:

SetValue[a,true]
SetValue[b,false]
SetValue[c,false]

Make sure GGBScript is selected in the drop-down menu. Don't forget to confirm the script by clicking OK. Close the Properties Dialog.

3 Repeat the same with checkbox b, just swap a and b in the script:

SetValue[b,true]
SetValue[a,false]
SetValue[c,false]

4 Similarly for checkbox c:

SetValue[c,true]
SetValue[b,false]
SetValue[a,false]

5 Try to click the checkboxes. At each time exactly one should be checked.

See: http://geogebrawiki.wikispaces.com/Radio+Buttons

Similar Ideas for other "buttons"

© 2022 International GeoGebra Institute