Hi,

A dynamically loaded icon is not visible in the context pane. Actually, it happens approximately every second time I am loading it into the context pane.

In my application, the view has 2 layouts:
- R_AVKON_STATUS_PANE_LAYOUT_SMALL - used as a default one
- R_AVKON_STATUS_PANE_LAYOUT_USUAL - only when executing a form

Each time, a form is to be shown - I switch to R_AVKON_STATUS_PANE_LAYOUT_USUAL as follows:
AppUi()->StatusPane()->SwitchLayout();
sp->ApplyCurrentSettingsL();
.

Then, I am setting the title pane:
TUid titlePaneUid;
titlePaneUid.iUid = EEikStatusPaneUidTitle;

CEikStatusPaneBase::TPaneCapabilities subPane = sp->PaneCapabilities(titlePaneUid);

if (subPane.IsPresent() && subPane.IsAppOwned())
{
CAknTitlePane* TitlePane = STATIC_CAST(CAknTitlePane*,
sp->ControlL(titlePaneUid) );
if (TitlePane)
{
HBufC* titleText = StringLoader::LoadLC(aResourceId);
TitlePane->SetTextL(*titleText);
CleanupStack::PopAndDestroy();
}
}

Next, I set the context pane icon:

TUid contextPaneUid;
contextPaneUid.iUid = EEikStatusPaneUidContext;

CEikStatusPaneBase::TPaneCapabilities subPane1 = sp->PaneCapabilities(contextPaneUid);

if (subPane1.IsPresent() && subPane1.IsAppOwned())
{
CAknContextPane* contextPane =
static_cast< CAknContextPane* >(sp->ControlL(contextPaneUid));

if(contextPane)
{
CFbsBitmap* icon = NULL;
CFbsBitmap* mask = NULL;

AknIconUtils::CreateIconLC( icon, mask, *iIconPath,
EMbmTestDialog, EMbmTestDialog_mask);
CleanupStack::Pop(2);
contextPane->SetPicture( icon, mask );
}

sp->ApplyCurrentSettingsL();
sp->DrawNow();

In RESOURCE file, I have defined a status pane with title and context pane.

What could be a reason for this odd behaviour? The icon appears only every second time I am loading it into the context pane.

BTW, It happens on hardware (N82).

Thanks in advance for help. I have been fighting with this problem for a long time. It is a real nightmare:(

Cheers,
Aga