diff -r 43e37759235e -r 51a74ef9ed63 Symbian3/SDK/Source/GUID-A51D3749-442A-54E8-8EB5-BF907694CD8C.dita --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Symbian3/SDK/Source/GUID-A51D3749-442A-54E8-8EB5-BF907694CD8C.dita Wed Mar 31 11:11:55 2010 +0100 @@ -0,0 +1,47 @@ + + + + + +Processing Window-Group Events

The following examples demonstrate how to get window-group related event types, which are global within the window group and include: key events, modifier changed events, window focus lost and gained events and user defined events.

Variant: ScreenPlay and non-ScreenPlay. Target audience: Application developers.

Key events

To detect if a key event has occurred, use the EEventKey, EEventKeyUp or EEventKeyDown event types.

You can get key event information by calling the TWsEvent::Key() function.

// Key events - get the key code + case EEventKey: + case EEventKeyUp: + case EEventKeyDown: + { + // Get the key event + TKeyEvent& keyEvent=*iWsEvent.Key(); + + // Get the key code: values are defined in TKeyEvent + TUint code = keyEvent.iCode; + break; + } +
Modifier changed events

To detect if a key modifier (the state of SHIFT, CTRL, etc. keys) changed event has occurred, use the EEventModifiersChanged event type.

You can get key event information by calling the TWsEvent::ModifiersChanged() function.

// A key modifier (e.g. SHIFT) changed + case EEventModifiersChanged: + { + // Get the state of the modifier keys + TKeyEvent& keyEvent=*iWsEvent.ModifiersChanged(); + + // Get the key modifiers: values are defined in TEventModifier + TUint modifiers = keyEvent.iModifiers; + break; + }

This event type is not reported unless explicitly requested by a window. Use RWindowTreeNode::EnableModifierChangedEvents() to request this event type.

Window focus lost and gained events

To detect if the window focus has been lost or gained, use the EEventFocusLost and EEventFocusGained event types.

You can get the handle to the window group whose focus has changed by calling TWsEvent::Handle().

// Window focus lost and gained events + case EEventFocusLost: + case EEventFocusGained: + { + // Get handle (typically a pointer) to the window group whose focus has changed + TUint handle = iWsEvent.Handle(); + break; + }
User-defined event received from another window

To detect if user-defined events have been received from another window, use EEventUser.

You can get information about the event by calling TWsEvent::EventData().

+ // User-defined event received from another window + case EEventUser: + { + // Get a pointer to the event data + TAny* data = iWsEvent.EventData(); + }
Window Server Client-Side Events + Overview Processing Window Events Processing System Events
\ No newline at end of file