Tip: Use captions to label your controls

Monday, June 23, 2008 at 3:36 PM



Some controls have a property called caption that conveniently acts as a built-in label for the control. Let's look at some examples:
  <button name="playButton" x="30" y="20" width="64" height="22"
image="button_up.png"
downImage="button_down.png"
overImage="button_over.png"
caption="Play"
font="Arial" size="9" color="#000000" />
  <radio name="jazzRadio" x="30" y="60" width="60"
image="radiobutton.png"
checkedImage="radiobutton_checked.png"
caption="Jazz"
font="Arial" size="9" color="#000000" />
  <checkbox name="classicalCheck" x="30" y="90" width="90"
image="checkbox_unchecked.gif"
downImage="checkbox_click.gif"
checkedImage="checkbox_checked.gif"
checkedDownImage="checkbox_click.gif"
overImage="checkbox_hover.gif"
caption="Classical"
font="Arial" size="9" color="#000000" />
You can use all of the properties of label, such as bold and italic, to style the caption. The text labels are considered as part of the control's clickable area, as you'd expect.

Have a tip you'd like to share? Send it to gd-developer AT google DOT com. To see all tips, choose the Tips label.

1 comment:

Teo said...

This is a good tip, and thanks for the new images, they're gonna help a lot :)