×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Dec 2005
    Posts
    17

    Strange problem when creating and printing a blank window

    I have this code which should create a new red window and then print it. Except it only works when I include the CWsScreenDevice function SizeInPixels() after the gc->Clear() command. Everything seems to work as it should, except nothing is displayed on the screen. I am using this code with the Series 60 emulator under VC++ 6. Is it a compiler bug or something as SizeInPixels() has nothing to do with the creation or printing of the window.


    wscheck = ws.Connect();
    if (wscheck != KErrNone) return ERROR;

    iScreenDevice = new(ELeave) CWsScreenDevice(ws);
    iScreenDevice->Construct();
    RWindowGroup* wg;
    wg = new RWindowGroup(ws);
    wscheck = wg->Construct(reinterpret_cast<TUint32>(wg), EFalse);
    CleanupClosePushL(*wg);
    wg->SetOrdinalPosition(10,ECoeWinPriorityAlwaysAtFront);
    CWindowGc* gc;
    wscheck = iScreenDevice->CreateContext(gc);
    CleanupStack::PushL(gc);

    RWindow window(ws);
    ScreenSize= iScreenDevice->SizeInPixels();
    wscheck = window.Construct(*wg, reinterpret_cast<TUint32>(wg) + 1);
    window.SetBackgroundColor(TRgb(0xFF, 0, 0));
    window.Activate();
    window.SetExtent(TPoint(0, 0), ScreenSize);
    window.SetVisible(ETrue);


    gc->Activate(window);
    window.Invalidate();
    window.BeginRedraw();
    gc->Clear();

    window.EndRedraw();

    //Only works when this command is included after gc->Clear()???
    //ScreenSize= iScreenDevice->SizeInPixels();

  2. #2
    Registered User
    Join Date
    Dec 2005
    Posts
    17

    Re: Strange problem when creating and printing a blank window

    Have found the problem, needed to flush the screen buffer with the line ws.Flush() after gc->Clear(). I presume iScreenDevice->SizeInPixels(); was doing that which was why it was making it work.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •