Changing the Appearance of Controls

FUNCTIONS

  void  setbackground(control c, rgb bg);	/* set bg colour */
  rgb   getbackground(control c);		/* find current bg */

  void  setforeground(control c, rgb fg);	/* text/fg colour */
  rgb   getforeground(control c);		/* find current fg */

  void  settextfont(control c, font f);		/* set text font */
  font  gettextfont(control c);			/* find current font */

NOTES

When a control or window is drawn on the screen, its rectangle is first cleared by filling it with its background colour, which is initially set to be a special value Transparent.

The setbackground function takes an rgb value as a parameter and sets the background colour to that value. The background colour is returned by getbackground as an rgb value.

After the background is drawn, the foreground colour is used in some places to draw text and other features of a control. The setforeground and getforeground functions access this foreground colour. It is not guaranteed that these colours will be used by all controls, or that their use will be consistent on different platforms.

The settextfont function changes the font used when drawing a control's text. Therefore, settextfont(t, newfont("Times", Bold, 18)) would change the font to a bold Times 18-pixel high typeface. Note that this function will not necessarily work with all controls on all platforms. It is, however, guaranteed to work with labels, and will probably work best on X-Windows platforms.

The gettextfont function returns which font is to be used when drawing a control's text.