RWindow Issues

Login to reply to this topic.
Thu, 2007-06-28 06:30
Joined: 2004-06-22
Forum posts: 148

Hi,

If I use the following code in my AppUi, I am able to make the RWindow visible/invisible :-

iWs = iCoeEnv->WsSession();

// Screen
iScreen = new(ELeave) CWsScreenDevice(iWs);
iScreen->Construct();

iGroup = RWindowGroup(iWs);
User::LeaveIfError(iGroup.Construct(reinterpret_cast(&iGroup), EFalse));
iGroup.SetOrdinalPosition(0, ECoeWinPriorityAlwaysAtFront);
iGroup.EnableReceiptOfFocus(EFalse);

// Window
iWindow = RWindow(iWs);
User::LeaveIfError(iWindow.Construct(iGroup, reinterpret_cast(&iGroup) + 1));

iWindow.Activate();
iWindow.SetExtent(TPoint(32, 134), TSize(134, 46));
iGroup.SetOrdinalPosition(0, 500);
iGroup.EnableReceiptOfFocus(EFalse);
iWindow.SetOrdinalPosition(0, 500);
iWindow.SetVisible(ETrue);

// Drawing with gc and window
CWindowGc& iGc = iCoeEnv->SystemGc();
iGc.Activate(iWindow);
TRect rect = TRect(iWindow.Size());
iWindow.Invalidate(rect);
iWindow.BeginRedraw(rect);
iGc.SetBrushColor(KRgbRed);
iGc.SetPenColor(KRgbBlack);
iGc.SetBrushStyle(CGraphicsContext::ESolidBrush);
iGc.Clear();

iWindow.EndRedraw();
iGc.Deactivate();
iWs.Flush();

However if I use this code in my CCoeControl container class I am not able to hide the window...

// Windows Session
User::LeaveIfError(iWs.Connect());

// Screen
iScreen = new(ELeave) CWsScreenDevice(iWs);
iScreen->Construct();

// Windows Group
iGroup = RWindowGroup(iWs);
User::LeaveIfError(iGroup.Construct(reinterpret_cast(&iGroup), EFalse));
iGroup.SetOrdinalPosition(0, ECoeWinPriorityAlwaysAtFront);
iGroup.EnableReceiptOfFocus(EFalse);

// Window Graphics
User::LeaveIfError(iScreen->CreateContext(iGc));

// Window
iWindow = RWindow(iWs);
User::LeaveIfError(iWindow.Construct(iGroup, reinterpret_cast(&iGroup) + 1));
iWindow.Activate();

iGc->Activate(iWindow);
TPoint pt(120, 280);
iWindow.SetExtent(pt, TSize(200, 50));
TRect rect = TRect(iWindow.Size());
iWindow.SetVisible(ETrue);
iWindow.Invalidate(rect);
iWindow.BeginRedraw(rect);
iGc->SetBrushColor(KRgbRed);
iGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
iGc->Clear();
iWindow.EndRedraw();
iGc->Deactivate();
iWs.Flush();

I Can call redraws in both the cases..however in the second case the makevisible and other window functions dont work. I am not sure whats wrong I am doing...Can someone please give me a helping hand..!

Also if I try to change the code

// Windows Session
User::LeaveIfError(iWs.Connect());

to

iWs = ControlEnv()->WsSession() in the container..i Get a Cone 46...what could that be..the SDK dont seem to have that error listed either..

Cheers
mayank


Thu, 2007-06-28 08:14
NewLC AdministratorSymbian AccreditedForum Nokia Champion
Joined: 2003-01-14
Forum posts: 2009
Re: RWindow Issues

CONE 46 is "The handle for the current Window Server Redraw event is invalid "


Eric Bustarret
NewLC Founder & CEO / Professional Symbian OS Consultant

Fri, 2007-06-29 12:32
Joined: 2004-11-29
Forum posts: 1246
Re: RWindow Issues

I'll put a link here to my answer to your same question on forum.nokia:

http://discussion.forum.nokia.com/forum/showthread.php?p=319922#post319922

(I'm olhed)

  • Login to reply to this topic.