Resources | Resources |



Using static widget

This example creates a static widget that will be used as the text for a button (it will be decorated with a button widget):

  1. Create a static widget and call c_simple_widget_app_SetText() to set the text for the static widget:
    if (AEE_SUCCESS != ISHELL_CreateInstance(pMe->piShell,
                AEECLSID_CStaticWidget, (void **)&piwStatic)) {
        return FALSE;
    // specify text for the static widget
    if (!c_simple_widget_app_SetText(piwStatic, BUTTONTEXT)) {
        return FALSE;

    c_simple_widget_app_SetText() gets the model for the static widget and then sets the value of the static widget (the text), as follows:

    // get the value model for the static widget
    nErr = IWidget_GetModel(piWidget, AEEIID_IValueModel,
    if (AEE_SUCCESS == nErr) {
        // set the value of the static widget to the desired text
        IValueModel_SetValue(pValModel, (void*)pwszText,
                WSTRLEN(pwszText), NULL);
        // release the value model since it's no longer needed
        (void) IValueModel_Release(pValModel);
  2. Set the button widget on the static widget:
    IDecorator_SetWidget((IDecorator *)(void*) pMe->piwButton,