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


2 - Five Choices

The ebm comes with five button control styles. The regular, pushbutton and repeating buttons all look the same, but act differently: the push button stays down, while the repeating button sends button press messages at regular intervals when held down. The other two buttons styles are also familiar, checkboxes and radio buttons (named after the old fashioned buttons on radios that only allowed one station selection at a time). If you've programmed in other GUI environments, the selection of buttons won't come as any surprise, although the calls might seem unusual. For example, the basic button is created with the following call:
  CButton( U16 id, U16 width, U16 height, const char *label,
           const IMAGE *up = 0, 
           const IMAGE *down = 0,
           const IMAGE *disabled = 0, 
           S16 xborder = 3, 
           S16 yborder = 2,
           S16 downoffset = 1 );
This call is identical for the CRepeatButton and CPushButton classes, and lacks the last three parameters for the CRadioButton and CCheckbox classes (which values only exist internally, and are always set to zero). Most of the parameters are optional, meaning you can create a button as simply as this in a form function:
  AddChild(new CButton(100,50,15,"Caption"),x,y);
At this point, the form will take control of the button, managing memory, displaying, pressing, and so forth.

It is these latter optional parameters that are most unique on the ebm. You can replace the default display of a button with a custom bitmap for the up and down position, as well as the disabled state (if not all three bitmaps are set the operating system synthesizes appropriate bitmaps from the 'up' bitmap). Using bitmaps eases the development work for button classes - in fact, the radio button is derived from the checkbox, with only new bitmaps needed for the check states.

Previous Section
Next Section

Copyright © 2001-2006 ebmDevMag.com - Legal Notice