Display and hide the status panel

Source: Internet
Author: User

Display and hide the status panel

In the afternoon, I practiced the display and hiding of the Status panel. The reference code is to use the container as a control, put it in the view, and then create a view in the AknViewAppUi, in the base, define the menu_bar of the view in the resource file. By writing this code, I reviewed the view writing method.

  1. Reference aknviewappui. h
  2. Write a class inherited from CAknViewAppUi
  3. Override the TUid Id () const Method
  4. Override void DoActivateL (const TVwsViewId & aPrevViewId, TUid aCustomMessageId, const TDesC8 & aCustomMessage)
  5. Override void DoDeactivate () method
  6. Write NewL, NewLC, and ConstructL methods to implement Second-Order Construction
  7. Void HandleCommandL (TInt aCommand) is not processed by the method itself, but is processed by aknViewAppUi.
  8. Void HandleStatusPaneSizeChange () is the method to be processed when the status panel changes

The code is written in the resource file and the newly created Project is converted into the view mode. When the Panel is written, there are only a few modern codes, as shown below:

CEikStatusPane * pan = StatusPane (); in this way, you can get a panel, and then use if (pan-> CurrentLayoutResId ()! = R_AVKON_STATUS_PANE_LAYOUT_EMPTY)
{
Pan-> SwitchLayoutL (R_AVKON_STATUS_PANE_LAYOUT_EMPTY );
}
Else
{
Pan-> SwitchLayoutL (R_AVKON_STATUS_PANE_LAYOUT_IDLE );
} To display and hide the status panel.

The above code is written in HandleCommandL in AknViewAppUi. Find a menu and add the code to the menu.

If you directly generate a project in the traditional mode through the wizard, you can write the following code in the AppUi:

Case estatuslx1_apptest:
{
// IEikonEnv-> InfoMsg (_ L ("test "));
CEikStatusPane * pan = StatusPane ();
If (pan-> CurrentLayoutResId ()! = R_AVKON_STATUS_PANE_LAYOUT_EMPTY)
{
Pan-> SwitchLayoutL (R_AVKON_STATUS_PANE_LAYOUT_EMPTY );
IAppContainer-> SetRect (ClientRect ());
IAppContainer-> DrawNow ();
}
Else
{
Pan-> SwitchLayoutL (R_AVKON_STATUS_PANE_LAYOUT_IDLE );
IAppContainer-> SetRect (ClientRect ());
IAppContainer-> DrawNow ();
}
Break;
}

IAppContainer-> SetRect (ClientRect (); the object is to reset the size and re-paint through DrawNow. Otherwise, the last panel is left, which does not seem to have been hidden.

Display and hide the status panel

Description of layout of R_AVKON_STATUS_PANE_LAYOUT_EMPTY

A total of four layout types
R_AVKON_STATUS_PANE_LAYOUT_IDLE implements a status panel with a clock
R_AVKON_STATUS_PANE_LAYOUT_USUAL (default)
R_AVKON_STATUS_PANE_LAYOUT_POWER_OFF_RECHARGE is the default one after the system is started (I tested it ).
R_AVKON_STATUS_PANE_LAYOUT_EMPTY to close the Panel

The preceding settings are set through SwitchLayoutL.

Anping 2009 @ original
Qi_jianzhou@126.com

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.