|Issue 49 May 23, 2008|
Quick Tip: Easy Toggle Buttons
If you've used Revolution much, you might know that you can drag out several radio buttons and group them to create an "exclusive" array of options. In that group, no two buttons are ever selected at the same time. A familiar example is the Page Setup dialog, where you'll find this:
That's quite handy for the conventional application of radio buttons. But have you ever thought of other situations where only one button has to be selected at a time? One that comes to mind is toolbar buttons. You can use the paint tool or the fill tool, but not both at once. Another is column headings. Typically, you cannot sort on two columns simultaneously. Here's an example from Windows Explorer:
As you can see, the arrow in the "Name" heading tells the user the folder is currently being sorted by the file name. The arrow would moves to other columns as they are clicked, and only one column can be active at a time.
You can spend a lot of time trying to recreate a similar effect in your stacks, but here's a very easy way to accomplish it with just a couple clicks in Revolution.
Now we need to do something about how it looks.
Now that we've set the necessary properties for the base button, duplicate it a few times, arrange them in a row, and give them unique names. As you click on them, you'll see that they behave exactly like the columns in Windows Explorer and elsewhere.
The same technique can be used for toggle buttons elsewhere. Whenever you specify an icon for a radio button, the icons are used instead of the typical radio button element. The label can be hidden depending on your needs.
Another nice element of this tip is using the "family" property of a control to group it, instead of an actual group. This is handy when you don't want or need the other behaviors of a group, and want to be able to manipulate elements without having to enable "Select Grouped" or use the "Edit Group" command.