Resources | Resources |



Using check widget

To create a check widget, call ISHELL_CreateInstance() with the AEECLSID_CCheckWidget ClassID . The radio widget is similarly created by calling ISHELL_CreateInstance() with the AEECLSID_CRadioWidget ClassID.

The default images used to represent each of the states associated with a checkbox or radio button are stored as resources in the 'widgets.mif' file. One resource is used to represent various portions of the widget and has 3 frames associated with it: the check mark, the inactive border, and the active border. These images may be overridden using the PROP_IMAGESTRIP property to specify a new bitmap to be used as the image frames.

Group buttons can be grouped using a single view model.

// Register listener with value model 

The text that usually accompanies a checkbox or radio button is not part of the checkbox or radio widget. Applications must separately create a static text widget and position that widget alongside the checkbox or radio button in order to create the appearance of a button followed by text.

Check widget's support of border properties can be used to create a distinctive appearance. For example, an application could set PROP_IMAGE_NFRAMES to 1 via IWidget_SetNFrames(), which only applies an extra image when the widget is checked. It could then set the widget background to a color gradient and use the border properties to give the widget a shadow to create a 3D effect.

The following is an example of creating a check widget.

ERR_TRY( ISHELL_CreateInstance(piShell, AEECLSID_CCheckWidget,
            (void**)&piwCheck) );
ERR_TRY( IWidget_GetModel(piwCheck, AEEIID_IValueModel,
            (IModel**)(void**)&pivmCheck) );
LISTENER_Init(pmlCheck, c_backlight_app_CheckCallback, pibl);
IValueModel_SetBool(pivmCheck, bEnabled);
IValueModel_AddListener(pivmCheck, pmlCheck);