Options For Button Widgets

Options For Button Widgets

First, you can display a bitmap instead of a text label:

You can also change the background and text color (or icon color!) when the mouse is over the button:

You can also disable a button at any time, so that clicking on it has no effect. This state is usually indicated by showing a special disabled color:

You'll notice that the color switches to green as soon as you click on a button, and subsequently you can't click on that button again, until you click on the Enable button.

The next example shows how to use highlighting to indicate the focus. This can be useful for when your button also has bindings for keyboard events such as when a key is pressed or released. The focus is assigned to a button when you click on it. In this example, I made the highlight color red and the highlight width 6 pixels. Awfully garish, but it illustrates the point:

Of course, you can do the same thing with bindings. In the last example for this page, I have set up a binding for noticing when the mouse enters a button to assign the focus to that button: