×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Super Contributor
    Join Date
    Jul 2007
    Posts
    596

    Question DrawNow() failed to call Draw()

    Hi All,

    Here Draw() is not get called althouugh i have called drawnow() in my container.This problem comes only for 2nd edition .

    i am below giving code snippet of my containerclass.


    TInt CMYContainer::CountComponentControls() const
    {
    return mNumControls;
    }

    CCoeControl* CMobileDMRContainer::ComponentControl(TInt aIndex) const
    {
    return mControls[aIndex];
    }

    void CMYContainer::Draw( const TRect& aRect) const
    {
    CWindowGc& gc = SystemGc();
    gc.SetBrushColor(KRgbRed);//BackColor());
    gc.Clear(aRect);


    // Clears the screen
    }

    void CMYContainer::Refresh()
    {
    DrawNow();
    }

    Can anyone suggest possible reasons.

    Interesting thing is that this code works fine for N70(2nd edtion fp2 device).
    but not in my emulator nor on other 2nd edition device.

    Thanks

  2. #2
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,751

    Re: DrawNow() failed to call Draw()

    Such miracles hardly exist. Every GUI application has at least one CCoeControl-derived something, and it usually works.
    How do you initialize the control itself, and its mNumControls, mControls members?

  3. #3
    Super Contributor
    Join Date
    Jul 2007
    Posts
    596

    Thumbs down Re: DrawNow() failed to call Draw()

    Quote Originally Posted by wizard_hu_ View Post
    Such miracles hardly exist. Every GUI application has at least one CCoeControl-derived something, and it usually works.
    How do you initialize the control itself, and its mNumControls, mControls members?
    Thanks For ur response. here below i am giving my initialisation part

    void CMobileDMRContainer::AddControl(CCoeControl* pCtrl)
    {
    if (pCtrl)
    {
    CleanupStack::PushL(pCtrl);
    mControls[mNumControls++] = pCtrl;
    PCtrl->SetContainerWindowL(*GetContainer());
    CleanupStack::Pop();
    }
    }

    Thanks

  4. #4
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,751

    Re: DrawNow() failed to call Draw()

    I just noticed that mControls is probably not a dynamic array. Are you sure about that you do not put more elements into it than its size?
    Since the N70 is actually a S60 2nd FP3 device, probably with slightly different HW than the earlier devices, it might be pure luck that some alignment-stuff allocates more memory for you than in earlier environments/the emulator.
    "CArrayPtr<CCoeControl> *iControls" might be a better solution. It has AppendL, Count, operator[]/At, ResetAndDestroy. Much safer.
    Also note that your code PushL-s and saves pCtrl, so upon a leave it is going to be a double-deletion (first the Cleanup Stack, second when you delete the elements of the array).

  5. #5
    Super Contributor
    Join Date
    Jul 2007
    Posts
    596

    Re: DrawNow() failed to call Draw()

    Quote Originally Posted by wizard_hu_ View Post
    I just noticed that mControls is probably not a dynamic array. Are you sure about that you do not put more elements into it than its size?
    Since the N70 is actually a S60 2nd FP3 device, probably with slightly different HW than the earlier devices, it might be pure luck that some alignment-stuff allocates more memory for you than in earlier environments/the emulator.
    "CArrayPtr<CCoeControl> *iControls" might be a better solution. It has AppendL, Count, operator[]/At, ResetAndDestroy. Much safer.
    Also note that your code PushL-s and saves pCtrl, so upon a leave it is going to be a double-deletion (first the Cleanup Stack, second when you delete the elements of the array).
    Hello wizard_hu_,

    This is solved now there was some problem in call sequence of ActivateL in between views.

    But here I found your suggestions very useful as manytimes before.

    One more query about double deletion.here since it is a class variable,I delete it at destructor.

    something like below
    if(membervariable)
    {
    delete variable
    membervariable= NULL;
    }

    Is it sufficient to do so to avoid double deletion.

    Thanks
    Last edited by kishore84; 2008-05-16 at 19:37.

Similar Threads

  1. Call conference
    By nukool_c in forum Mobile Java General
    Replies: 7
    Last Post: 2007-09-07, 21:30
  2. Problem: when call "SetFocusScreen" failed.
    By caixiaowei586 in forum Symbian
    Replies: 3
    Last Post: 2006-08-07, 03:09
  3. Can not trap Outgoing call disconnection
    By jugnoyasir in forum Symbian
    Replies: 1
    Last Post: 2005-08-13, 10:50
  4. call events after dialing from the app
    By white_dragon in forum Symbian
    Replies: 2
    Last Post: 2005-05-18, 22:30
  5. How to make simultaneous VOICE and DATA call on a Nokia Phone?
    By venkat_nokia in forum PC Suite API and PC Connectivity SDK
    Replies: 0
    Last Post: 2004-04-28, 12:15

Posting Permissions

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