, __status(ORIENTATION_PORTRAIT)
, __panelId(0)
{
+ __pPanel[0] = null;
+ __pPanel[1] = null;
+ __pPanel[2] = null;
}
MainForm::~MainForm(void)
}
result
+MainForm::CreateImagePanel(void)
+{
+ ImagePanel* pImagePanel = new (std::nothrow) ImagePanel();
+ pImagePanel->Initialize(Rectangle(0, 0, GetClientAreaBounds().width, GetClientAreaBounds().height));
+ AddOrientationEventListener(*pImagePanel);
+ AddControl(*pImagePanel);
+ __pPanel[2] = pImagePanel;
+}
+
+result
MainForm::OnInitializing(void)
{
result r = E_SUCCESS;
}
}
- // Set Image Panel
- ImagePanel* pImagePanel = new (std::nothrow) ImagePanel();
- pImagePanel->Initialize(rect);
- AddOrientationEventListener(*pImagePanel);
- AddControl(*pImagePanel);
- __pPanel[2] = pImagePanel;
-
// Set the current panel as selected in the header and display it on the form
if (pHeader)
{
if(__panelId == 2)
{
+ if (__pPanel[2] == null)
+ {
+ CreateImagePanel();
+ }
SetOrientation(ORIENTATION_AUTOMATIC);
}
- __pPanel[0]->SetShowState(false);
- __pPanel[1]->SetShowState(false);
- __pPanel[2]->SetShowState(false);
+ if (__pPanel[0] != null)
+ {
+ __pPanel[0]->SetShowState(false);
+ }
+ if (__pPanel[1] != null)
+ {
+ __pPanel[1]->SetShowState(false);
+ }
+
__pPanel[__panelId]->SetShowState(true);
}
{
case ID_HEADER_ITEM1:
{
- __pPanel[0]->SetShowState(true);
- __pPanel[1]->SetShowState(false);
- __pPanel[2]->SetShowState(false);
+ if (__pPanel[0] != null)
+ {
+ __pPanel[0]->SetShowState(true);
+ }
+ if (__pPanel[1] != null)
+ {
+ __pPanel[1]->SetShowState(false);
+ }
+ if (__pPanel[2] != null)
+ {
+ __pPanel[2]->SetShowState(false);
+ }
SetOrientation(ORIENTATION_PORTRAIT);
}
break;
case ID_HEADER_ITEM2:
{
- __pPanel[0]->SetShowState(false);
- __pPanel[1]->SetShowState(true);
- __pPanel[2]->SetShowState(false);
+ if (__pPanel[0] != null)
+ {
+ __pPanel[0]->SetShowState(false);
+ }
+ if (__pPanel[1] != null)
+ {
+ __pPanel[1]->SetShowState(true);
+ }
+ if (__pPanel[2] != null)
+ {
+ __pPanel[2]->SetShowState(false);
+ }
SetOrientation(__status);
}
break;
case ID_HEADER_ITEM3:
{
- __pPanel[0]->SetShowState(false);
- __pPanel[1]->SetShowState(false);
- __pPanel[2]->SetShowState(true);
+ if (__pPanel[2] == null)
+ {
+ CreateImagePanel();
+ }
+ if (__pPanel[0] != null)
+ {
+ __pPanel[0]->SetShowState(false);
+ }
+ if (__pPanel[1] != null)
+ {
+ __pPanel[1]->SetShowState(false);
+ }
+ if (__pPanel[2] != null)
+ {
+ __pPanel[2]->SetShowState(true);
+ }
SetOrientation(ORIENTATION_AUTOMATIC);
}
break;