# Programming with Text Button Controls

Use SetCtrlVal to set the state of a text button.

Use GetCtrlVal to obtain the state of a text button.

Use SetCtrlAttribute and GetCtrlAttribute with the ATTR_ON_TEXT and ATTR_OFF_TEXT attributes to set and get the string displayed on the button.

Use GetCtrlAttribute with the ATTR_ON_TEXT_LENGTH and ATTR_OFF_TEXT_LENGTH attributes to determine the size of the buffer needed to get the button labels. Keep in mind that GetCtrlAttribute appends a NULL byte to the end of the text string, so you must make the buffer 1 byte larger than the value obtained using ATTR_ON_TEXT_LENGTH or ATTR_OFF_TEXT_LENGTH.