ebmDevMag.com home
ebm Developer's Magazine
links

developer's mag
main page

article
part 1
part 2
part 3
part 4
part 5
part 6
part 7
part 8
part 9


8 - More Limitations

Of course, this paLabel class suffers from limitations as well. Most significantly:
  • The background is always white, and the text is always black.
  • There is no justification.
  • Effects aren't possible, aside from changing the font.
To expand on text display, we'll have to dynamically draw our text, using the CWindow call DrawText():
  S16 DrawText( const char *text, 
                S16 x, S16 y, 
                const FONT *font=0, 
                COLOR foreground=0, 
                COLOR background=0, 
                S32 len=-1, 
                ImgCmb mode= IMG_CMB_SRC );
The parameters for the full function call include the text string, x and y coordinates for drawing, and optional parameters: font, foreground and background colors, length, and copy mode. The length allows you to limit display to a group of characters instead of the whole string, while using -1 indicates the whole string is to be drawn. The copy mode indicates how the string is drawn, with the default IMG_CMB_SRC drawing the same as CLabel. These last parameters are all optional, and will default to drawing the full string in black on white, in the default window font.

Previous Section
Next Section

Copyright © 2001-2006 ebmDevMag.com - Legal Notice