03.01.2013 Views

Chapter 1

Chapter 1

Chapter 1

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

CCoeControlStack::OfferKeyL(const TKeyEvent &, TEventCode)<br />

CEikMenuBar::OfferKeyEventL(const TKeyEvent &, TEventCode)<br />

CEikMenuBar::DoOfferKeyEventL(const TKeyEvent &, TEventCode)<br />

CEikMenuPane::OfferKeyEventL(const TKeyEvent &, TEventCode, int)<br />

CEikMenuPane::DoOfferKeyEventL(const TKeyEvent &, TEventCode, int)<br />

CEikMenuPane::ReportSelectionMadeL()<br />

CEikMenuPane::ProcessCommandToAllObserversL(int)<br />

CQikAppUi::ProcessCommandL(int)<br />

CQHelloGuiAppUi::HandleCommandL(int)<br />

We have an event being handled by an active object's RunL() function, but this time the raw<br />

window server event is identified as a key event. The app UI delegates keystroke distribution<br />

to the control stack, which offers it to the menu bar, which in turn offers it to the menu pane.<br />

The menu pane reports that a selection has been made, which results in the menu being<br />

dismissed (in CQikAppUi::ProcessCommandL()), and the command being handled by<br />

HandleCommandL().<br />

We'll see the control stack, and its role in key handling, in <strong>Chapter</strong> 12.<br />

Note<br />

Why didn't the app view redraw when you switched from the HelloGui to the<br />

Edit menu pane, or when the menu pane disappeared? The answer is that<br />

these panes are handled using windows that maintain a backup copy of<br />

whatever is underneath them – so- called 'backed-up behind' windows.<br />

When the window moves or is dismissed, the window server replaces<br />

whatever was underneath from the backup copy, without asking for the<br />

application to redraw. Before this feature was implemented (prior to the first<br />

release of Symbian OS), flipping between menu panes was very slow in all<br />

but the simplest applications.<br />

4.8.3 Commands from Shortcut Keys<br />

The final way into HandleCommandL() is via a shortcut key. You know that you can close<br />

the application with Ctrl+E ; try this, and you'll get:<br />

CCoeEnv::RunL()<br />

CQikAppUi::HandleWsEventL(const TWsEvent &, CCoeControl *)<br />

CEikAppUi::HandleWsEventL(const TWsEvent &, CCoeControl *)<br />

CCoeAppUi::HandleWsEventL(const TWsEvent &, CCoeControl *)<br />

CCoeControlStack::OfferKeyL(const TKeyEvent &, TEventCode)<br />

CEikMenuBar::OfferKeyEventL(const TKeyEvent &, TEventCode)<br />

CEikMenuBar::DoOfferKeyEventL(const TKeyEvent &, TEventCode)<br />

CQikAppUi::ProcessCommandL(int)<br />

CQHelloGuiAppUi::HandleCommandL(int)<br />

As before, RunL() handles the event, while HandleWsEventL()decides it's a key and gets<br />

it handled by the control stack. The control stack offers it to the menu bar, which recognizes<br />

shortcut keys and calls the application to process them.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!