diff -r 000000000000 -r 89d6a7a84779 Symbian3/SDK/Source/GUID-B7FF0B9C-3A17-5AAA-A986-7BA4F44DBD41.dita --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Symbian3/SDK/Source/GUID-B7FF0B9C-3A17-5AAA-A986-7BA4F44DBD41.dita Thu Jan 21 18:18:20 2010 +0000 @@ -0,0 +1,44 @@ + + + + + +Declaring a Window Server Event-Handling ClassThe following example demonstrates how to declare an active object Window Server event handling class.

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

The steps are:

/* An active object that wraps a Window Server session. + An event being received causes RunL() to be called, + where the event is processed. */ + +class CExampleWsClient : public CActive + { +public: + ... + + // Active object protocol + void RunL (); + void DoCancel(); + + // Issue request to Window Server for events + IssueRequest(); + +private: + + // Access to Window Server session + RWsSession& iWs; + + // Access to screen device + CWsScreenDevice& iScreen; + + // Window server general event + TWsEvent iWsEvent; + };
Issuing a request to the Window Server

Once the active object has been constructed, a request can be issued. In the following code fragment, the active object provides the function IssueRequest() to invoke the encapsulated event request function. Pass the a TRequestStatus object, iStatus, to the EventReady() function to request Window Server events from the iWs Window Server session.

Use the CActive::SetActive() function, to indicate that the active object is currently active.

/* Request Window Server events */ +void CExampleWsClient::IssueRequest() + { + iWs.EventReady(&iStatus;); // request an event + SetActive(); // so we're now active + }
Window Server Client-Side Events + Overview General Events
\ No newline at end of file