Resources | Resources |



Using softkey widget

The softkey widget is instantiated by calling ISHELL_CreateInstance() with the AEECLSID_CSoftkeyWidget ClassID .

The softkey widget is a prop container consisting of a pair of embedded static text widgets: softkey one and softkey two. Though the layout and interaction of these widgets is handled together by the softkey widget, each is displayed independently and functions independently of the other. For example, an application may choose to alter the color or font of one softkey to place emphasis on one button or the other.

Note: The softkey widget only creates the softkeys. It does not handle EVT_KEY events. Applications must separately create an appropriate wrapper around the widget, so that when AVK_SOFT1/AVK_SOFT2 is pressed, applications change the visual representation of underlying static widgets. The static widgets can be retrieved by getting the PROP_SOFTKEY1 and PROP_SOFTKEY2 properties.

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

  1. Call ISHELL_CreateInstance() with a ClassID of AEECLSID_CSoftkeyWidget to create a softkey widget. ISHELL_CreateInstance() retrieves a reference counted instance of the class that manages the widget.
    ERR_TRY( ISHELL_CreateInstance(me->piShell, AEECLSID_CSoftkeyWidget, 
  2. Call IWidget_GetSoftkey() to get the softkey widgets, as follows:
    ERR_TRY( IWidget_GetSoftkey(piw, PROP_SOFTKEY1, &piwsk1));
    ERR_TRY( IWidget_GetSoftkey(piw, PROP_SOFTKEY2, &piwsk2));
  3. Call IWidget_SetText() to specify the text to be displayed for each of the softkeys. For example:
    ERR_TRY( IWidget_SetText(piwsk1, awszLeft, 0));
  4. Call IWidget_SetExtent() to set the size of the softkey widget.
    IWidget_GetPreferredExtent(me->piwSoftkey, &we);
    we.width = me->rcContainer.dx;
    IWidget_SetExtent(me->piwSoftkey, &we);
  5. As necessary, call various IWidget_Setxxxxxx() functions to override any of the default visual characteristics of the widget. For example:
    ERR_TRY( IWidget_SetFGColor(piwsk1, RGB_MENU_FG));
    ERR_TRY( IWidget_SetFGColor(piwsk2, RGB_MENU_FG));