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.
- Reference aknviewappui. h
- Write a class inherited from CAknViewAppUi
- Override the TUid Id () const Method
- Override void DoActivateL (const TVwsViewId & aPrevViewId, TUid aCustomMessageId, const TDesC8 & aCustomMessage)
- Override void DoDeactivate () method
- Write NewL, NewLC, and ConstructL methods to implement Second-Order Construction
- Void HandleCommandL (TInt aCommand) is not processed by the method itself, but is processed by aknViewAppUi.
- 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