×
Namespaces

Variants
Actions
Revision as of 14:34, 21 June 2011 by hamishwillee (Talk | contribs)

Detecting Focus Change

From Nokia Developer Wiki
Jump to: navigation, search

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
...
}
else
{
// We have lost the focus
...
}
}

See also

Alternative method using MCoeForegroundObserver.

50 page views in the last 30 days.
×