Tip: Set mouse cursors for your elements

Monday, January 28, 2008 at 5:58 PM

Did you know you can specify the type of mouse cursor to display for an individual element? basicElement has a cursor property that can be set to various cursor types. This can improve the usability of your gadget a great deal when appropriate cursors are used for different elements or program states. For example, you could use the hand cursor for clickable items or the wait cursor when the gadget is busy and is unable to respond.

Say you have a button named submitButton. Here is some code that will update the mouse cursor for the button, depending on the availability of the action.
if (isGadgetBusy()) {
submitButton.cursor = "wait";
} else {
submitButton.cursor = "hand";
Have a tip you'd like to share? Send it to gd-developer AT google DOT com.

No comments: