Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

Detecting Focus Change

From Wiki
Jump to: navigation, search
Article Metadata
Created: giridharn (24 May 2007)
Last edited: hamishwillee (30 May 2013)

The S60 framework will notify an application when it gains or loses the keyboard focus through a call to CAknAppUi::HandleForegroundEventL( TBool aForeground ) function. The aForeground parameter is true if the application has gained keyboard focus, false if it has lost it.

This function can be reimplemented whenever an application needs to react to focus change events. However, the base class should be called in order not to disrupt framework's event handling.

For example:

void CMyAppUi::HandleForegroundEventL( TBool aForeground )
// Call base class implementation
CAknAppUi::HandleForegroundEventL( aForeground );
if( aForeground )
// We have gained the focus
// We have lost the focus

See also

Alternative method using {{{1}}}.

This page was last modified on 30 May 2013, at 04:33.
85 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.


Thank you!

We appreciate your feedback.