drawing a CCoeControl from a server

Login to reply to this topic.
Wed, 2006-04-26 15:10
Joined: 2006-04-05
Forum posts: 104
Hi,

I was looking at the article on NewLC that describes how to display an icon next to the battery indicator on Series 60.  The idea is that the icon is visible even if the application is not in the foreground. 

http://www.newlc.com/How-to-draw-an-Icon-on-the.html

Excelent article.  I gave it a whirl and it worked first time in an application environment.  However my problem is that i would like to do it run the same functionality from a server rather than an application.

The code creates a CCoeControl that it then runs from an example application. 

The ConstructL of the CCoeControl in the example looks like this:

void CIndicatorIcon::ConstructL()
        {
        iMyWindowGroup = RWindowGroup(iCoeEnv->WsSession());
        User::LeaveIfError(iMyWindowGroup.Construct((TUint32)&iMyWindowGroup));

        iMyWindowGroup.SetOrdinalPosition(0, ECoeWinPriorityAlwaysAtFront);
        iMyWindowGroup.EnableReceiptOfFocus(EFalse);

        CreateWindowL(&iMyWindowGroup);

        // by default setting the indicator icon to inactive
        SetIndicatorIconL(EIndicatorIconAppActive);

        ActivateL();
        }


Here is where the problems started.  Since my component is not an application i don´t have an iCoeEnv.

I tried manually creating a session to the window server and then passing that in the contructor of the RWindowGroup which i then passed to the CreateWindowL.  I don´t get any errors or indications that there is a problem until i call CreateWindowL at which point (on the emulator) execution grinds to a halt somewhere in the system code giving me no clue as to what the problem is.

I´m not even sure if what i´m trying to do here is possible.  Can you use a CCoeControl class outside of the scope of an application?

If so does anyone have any ideas as to what i might have done wrong here or how i can better debug the code?

Best regards

PL

Thu, 2006-04-27 06:39
Joined: 2005-10-13
Forum posts: 33
Re: drawing a CCoeControl from a server
You will need to use CONE if you want to use CCoeControls.

Now you could try and make your own lightweight CONE-equiv and your own equiv of CCoeControl, and such.  There are just a few mechanisms you have to implement, ....

... but its far easier to just use CONE!

There is nothing stopping an EXE using CONE even if you don't consider yourself an "app".  Thats a distinction you're making, and the libraries aren't.

Create yourself a CEikonEnv.  This won't stop any CServer(2)s running and working in your thread.
Thu, 2006-04-27 17:24
Joined: 2006-04-05
Forum posts: 104
Re: drawing a CCoeControl from a server
Hi,

Thanks for the quick reply.

Can you expand a little on how to generate the CEikonEnv manually.  I gave it a try like this:

void CIndicatorIcon::ConstructL()
   {
   iMyEikonEnv = new(ELeave)CEikonEnv();
   iMyEikonEnv->ConstructL();
   iMyWindowGroup = RWindowGroup(iMyEikonEnv->WsSession());
   User::LeaveIfError(iMyWindowGroup.Construct((TUint32)&iMyWindowGroup));

   iMyWindowGroup.SetOrdinalPosition(0, ECoeWinPriorityAlwaysAtFront);
   iMyWindowGroup.EnableReceiptOfFocus(EFalse);

   CreateWindowL(&iMyWindowGroup);

   // by default setting the indicator icon to inactive
   SetIndicatorIconL(EIndicatorIconAppActive);

   ActivateL();
   }


where iMyEikonEnv is a member variable pointer of type CEikonEnv of the CIndicatorIcon class.

However this crashes on the line

iMyEikonEnv->ConstructL();

The SDK indicated that i should call the second phase construction after the new call.

i am doing something daft here?

BR

PL
Mon, 2007-04-30 18:34
Joined: 2005-06-04
Forum posts: 131
Re: drawing a CCoeControl from a server
Hi,

Did you solve this problem?
It crased because the construction must be trapped.
TRAPD(error,CIndicatorIcon* iIndicatorIcon = CIndicatorIcon::NewL());

It go through iMyEikonEnv->ConstructL(), but I get KERN-EXEC 3 on CreateWindowL(&iMyWindowGroup).

Any idea how to make it in exe?

Thanks
Fri, 2007-05-04 14:05
Joined: 2007-03-09
Forum posts: 7
Re: drawing a CCoeControl from a server
I havn't tried to draw a CoeControl from the server but I have implemented an indicator icon in the idle screen. The indicator is drawn from a server.

The way I did it is describe here

http://wiki.forum.nokia.com/index.php/Drawing_to_the_screen_outside_application_framework

However, I had big problems to get the window to be transparent and blend in on the skin(still doesnt work flawless Undecided). I think the CoeControl is a better solution if you can get it to work.

The more I learn, the more I realize how little I know...

  • Login to reply to this topic.