| 101 | | And disabled: |
| 102 | | <div class="box"> |
| 103 | | <button dojoType="Button" disabled="true" onclick='dojo.debug("clicked simple")'> |
| 104 | | <img src="images/plus.gif"> Create |
| 105 | | </button> |
| 106 | | <button dojoType="Button" disabled="true" onclick='dojo.debug("clicked simple")'> |
| 107 | | <img src="images/plus.gif"><br>Create |
| 108 | | </button> |
| 109 | | <button dojoType="dropdownButton" menuId='editMenu' disabled="true"> |
| 110 | | <img src="images/note.gif"> Edit |
| 111 | | </button> |
| 112 | | <button dojoType="dropdownButton" menuId='editMenu' disabled="true"> |
| 113 | | <img src="images/note.gif"><br>Edit |
| 114 | | </button> |
| 115 | | <button dojoType="comboButton" menuId='saveMenu' onClick='dojo.debug("clicked combo save");' disabled="true"> |
| 116 | | <img src="images/save.gif"> Save |
| 117 | | </button> |
| 118 | | <button dojoType="comboButton" menuId='saveMenu' onClick='dojo.debug("clicked combo save");' disabled="true"> |
| 119 | | <img src="images/save.gif"><br>Save |
| 120 | | </button> |
| 121 | | <div style="clear: both;"></div> |
| 122 | | </div> |
| 148 | | <p>Disabled:</p> |
| 149 | | <div class="box"> |
| 150 | | <button dojoType="Button" onclick='dojo.debug("big");' disabled="true"> |
| 151 | | <img src="images/flatScreen.gif"> |
| 152 | | <span style="font-size:xx-large">big</span> |
| 153 | | </button> |
| 154 | | <button id="smallButton1dis" dojoType="Button" onclick='dojo.debug("small");' disabled="true"> |
| 155 | | <img src="images/arrowSmall.gif"> |
| 156 | | <span style="font-size:x-small">small</span> |
| 157 | | </button> |
| 158 | | <button dojoType="Button" onclick='dojo.debug("long");' disabled="true"> |
| 159 | | <img src="images/tube.gif" height=16> |
| 160 | | long |
| 161 | | </button> |
| 162 | | <button dojoType="Button" onclick='dojo.debug("tall");' width2height="0.1" disabled="true"> |
| 163 | | <div> |
| 164 | | <img src="images/tubeTall.gif" height=75px width=35px><br> |
| 165 | | <span style="font-size:medium">tall</span> |
| 166 | | </div> |
| 167 | | </button> |
| 168 | | <div style="clear: both;"></div> |
| 169 | | </div> |
| 170 | | |
| 171 | | |
| | 127 | <br clear=both> |
| | 152 | <h2>Programatically changing buttons</h2> |
| | 153 | <p>clicking the buttons below will change the buttons above</p> |
| | 154 | <script> |
| | 155 | function forEachButton(func){ |
| | 156 | dojo.lang.forEach( |
| | 157 | dojo.lang.unnest( |
| | 158 | dojo.widget.manager.getWidgetsByType("Button"), |
| | 159 | dojo.widget.manager.getWidgetsByType("DropDownButton"), |
| | 160 | dojo.widget.manager.getWidgetsByType("ComboButton"), |
| | 161 | dojo.widget.manager.getWidgetsByType("UserButton") |
| | 162 | ), |
| | 163 | func |
| | 164 | ); |
| | 165 | } |
| | 166 | |
| | 167 | var disabled=false; |
| | 168 | function toggleDisabled(){ |
| | 169 | disabled=!disabled; |
| | 170 | forEachButton(function(widget){ widget.setDisabled(disabled); }); |
| | 171 | dojo.byId("toggle").innerHTML= disabled ? "Enable all" : "Disable all"; |
| | 172 | } |
| | 173 | var captions=["<img src='images/note.gif'>All", "<i>work</i>", "and", "no", "<h1>play</h1>", |
| | 174 | "<span style='color: red'>makes</span>", "Jack", "<h3>a</h3>", "dull", |
| | 175 | "<img src='images/plus.gif'>boy"]; |
| | 176 | var idx=0; |
| | 177 | function changeCaptions(){ |
| | 178 | forEachButton(function(widget){ widget.setCaption( captions[idx++ % captions.length]); }); |
| | 179 | } |
| | 180 | </script> |
| | 181 | <div> |
| | 182 | <button id="toggle" onclick='toggleDisabled()'>Disable all</button> |
| | 183 | <button onclick='changeCaptions()'>Change caption</button> |
| | 184 | <button onclick='location.reload()'>Revert</button> |
| | 185 | </div> |
| | 186 | |