How to use AEECLSID_SoftkeyWidget | developer.brewmp.com How to use AEECLSID_SoftkeyWidget | developer.brewmp.com

Developer

How to use AEECLSID_SoftkeyWidget

Forums:

For API document description like below

1. Call ISHELL_CreateInstance() with a class ID of AEECLSID_SoftkeyWidget to
create a softkey widget. ISHELL_CreateInstance() will retrieve a reference
counted instance of the class that manages the widget.
2. IWidget_SetText() to specify the text to be displayed within each of the
softkeys.
3. Call IWidget_SetExtent() to set the size of the softkey widget.
4. As necessary, call various IWIDGET_Setxxxxxx() functions to override any of
the default visual characteristics of the widget. For example, if the
text of one softkey should be bright blue, or if the border of the widget
should possess a shadow.

But after I create ISHELL_CreateInstance(pMe->pIShell, AEECLSID_SoftkeyWidget, &pSoftKeyWidget);
And then use IWidget_SetText(pSoftKeyWidget, L"SoftKey", FALSE), would return AEE_EFAILED

Q1:SoftKeyWidget has PROP_SOFTKEY1 and PROP_SOFTKEY2, how could I set the string to key text
Q2:SoftKeyWidget is set into RootFrom or can set into Container, my code like below

int DisplayIdleScr(Application3* pMe)
{
int result = 0;
IConstraintContainer* pConstraintContainer;
WidgetConstraint widgetContraint ;
IWidget* *pIConstraintContainerWidget;
IWidget* pRSSIWidget;
IImage* pRSSIImage;
IWidget* pBatWidget;
IImage* pBatImage;
IImage* pBackgroundImage;
IWidget* pSoftKeyWidget;
AEEImageInfo infRSSIImage;
AEEImageInfo infBarImage;

result = ISHELL_CreateInstance(pMe->pIShell, AEECLSID_RootForm, &pMe->pRootForm);
result = ISHELL_CreateInstance(pMe->pIShell, AEECLSID_Form, &pMe->pForm);
result += ISHELL_CreateInstance(pMe->pIShell, AEECLSID_ConstraintContainer, &pConstraintContainer);
result += ISHELL_CreateInstance(pMe->pIShell, AEECLSID_ImageWidget, &pRSSIWidget);
result += ISHELL_CreateInstance(pMe->pIShell, AEECLSID_ImageWidget, &pBatWidget);
result += ISHELL_CreateInstance(pMe->pIShell, AEECLSID_SoftkeyWidget, &pSoftKeyWidget);

pRSSIImage = ISHELL_LoadResImage(pMe->pIShell, APPLICATION3_RES_FILE, IMAGE_RSSI_5001);
result += IWidget_SetTranspColor(pRSSIWidget, MAKE_RGB(36, 255, 0));
IWidget_SetImage(pRSSIWidget, pRSSIImage);

pBatImage = ISHELL_LoadResImage(pMe->pIShell, APPLICATION3_RES_FILE, IMAGE_BATTERY_5002);
result += IWidget_SetTranspColor(pBatWidget, MAKE_RGB(36, 255, 0));
IWidget_SetImage(pBatWidget, pBatImage);

pBackgroundImage = ISHELL_LoadResImage(pMe->pIShell, APPLICATION3_RES_FILE, IMAGE_BACKGROUND_5003);
result += IForm_SetBGImage(pMe->pForm, pBackgroundImage);

widgetContraint.constraint.top.type = CONSTRAINT_PARENT_TOP;
widgetContraint.constraint.left.type = CONSTRAINT_PARENT_LEFT;
widgetContraint.constraint.right.type = WIDGET_SIZE_TO_FIT;
widgetContraint.constraint.bottom.type = WIDGET_SIZE_TO_FIT;
widgetContraint.bVisible = TRUE;
result += IConstraintContainer_Insert(pConstraintContainer, pRSSIWidget, WIDGET_ZNORMAL, &widgetContraint);

IImage_GetInfo(pRSSIImage,&infRSSIImage);
IImage_GetInfo(pBatImage,&infBarImage);
widgetContraint.constraint.left.offset = pMe->DeviceInfo.cxScreen - infRSSIImage.cx - infBarImage.cx;
widgetContraint.constraint.top.type = CONSTRAINT_PREV_TOP;
widgetContraint.constraint.left.type = CONSTRAINT_PREV_RIGHT;
widgetContraint.constraint.right.type = CONSTRAINT_PARENT_RIGHT;
widgetContraint.constraint.bottom.type = WIDGET_SIZE_TO_FIT;
result += IConstraintContainer_Insert(pConstraintContainer, pBatWidget, WIDGET_ZNORMAL, &widgetContraint);

result += IConstraintContainer_QueryInterface(pConstraintContainer, AEEIID_WIDGET, (void**)&pIConstraintContainerWidget );
result += IForm_SetWidget(pMe->pForm, WID_FORM, pIConstraintContainerWidget);

result += IForm_SetWidget(IRootForm_to_IForm(pMe->pRootForm), WID_SOFTKEYS, pSoftKeyWidget);

/* Not only no error but also not work */
/* SoftKeyWidget is ser into RootForm or Container */
result += IRootForm_PushForm(pMe->pRootForm, pMe->pForm);

IQI_RELEASEIF(pConstraintContainer);
IQI_RELEASEIF(pIConstraintContainerWidget);
IQI_RELEASEIF(pRSSIWidget);
IQI_RELEASEIF(pRSSIImage);
IQI_RELEASEIF(pBatWidget);
IQI_RELEASEIF(pBatImage);
IQI_RELEASEIF(pBackgroundImage);
IQI_RELEASEIF(pSoftKeyWidget);

return result;

You don't need to create a softkey widget, the root form will create one automatically.
Use IForm_SetSoftkeys() to set the form's softkey labels. When the form is pushed onto the root form, the root form will automatically update the softkey widget with the form's softkey labels.

You don't need to create a softkey widget, the root form will create one automatically.
Use IForm_SetSoftkeys() to set the form's softkey labels. When the form is pushed onto the root form, the root form will automatically update the softkey widget with the form's softkey labels.

Thanks for your reply

Thanks for your reply