Resources | developer.brewmp.com Resources | developer.brewmp.com

Developer

resources

Using slider widget

The following code example shows how to implement a slider widget.

To create a slider widget, an application would do the following:

  1. Call ISHELL_CreateInstance() with a ClassID of AEECLSID_CSliderWidget to create an instance of the slider widget, as follows:
    ERR_TRY( ISHELL_CreateInstance(me->piShell, AEECLSID_CSliderWidget, 
                    (void**)&piw) );
  2. Set properties to control the widget's appearance or function. For example:
    // set up the slider widget
    ERR_TRY( IWidget_SetLayoutStyle(piw, LAYOUT_HORZ));
    ERR_TRY( IWidget_SetPadding(piw, 2));
    ERR_TRY( IWidget_SetBorderWidth(piw, 2));
    ERR_TRY( IWidget_SetBorderColor(piw, RGB_BORDER));
    ERR_TRY( IWidget_SetBGColor(piw, RGB_8));
    ERR_TRY( IWidget_SetSliderHandleBorderColor(piw, RGB_7));
    ERR_TRY( IWidget_SetSliderMaxPos(piw, 50));
  3. Set the extent of the widget. For example:
    we.height = 14;
    we.width = 80;
    IWidget_SetExtent(piw, &we);
  4. Place the widget in a container, as follows:
    wpos.x = 0;
    wpos.y = 0;
    wpos.bVisible = TRUE;
    ERR_TRY( IXYContainer_Insert(*pif, piw, WIDGET_ZNORMAL, &wpos ));