×

Discussion Board

Results 1 to 9 of 9
  1. #1
    Regular Contributor
    Join Date
    Mar 2007
    Posts
    119

    CAknDialog with grey background

    Hello,

    When showing dialogs (for example progress dialog, wait dialog etc.) the content behind the dialog gets greyed out. I would like to achieve the same behaviour in my CAknDialog derived class, which contains a CCoeControl and fills (EEikDialogFlagFillAppClientRect flag) the client rect. Precisely, I'd like to get the status pane area (not the status pane itself necessarily, as the application may be a full screen one) greyed out.

    Can you help me in achieving this?

    Cheers,
    Maciej

  2. #2
    Super Contributor
    Join Date
    Jul 2008
    Location
    Chennai,India
    Posts
    889

    Re: CAknDialog with grey background

    Have you tried watching the background what is happening out actually...

    If u want the clientRec() to be greyed out..
    try drawing a custom(transparent mask) for the ClientRect() area and then display ur custom CAknDialog..

  3. #3
    Regular Contributor
    Join Date
    Jun 2007
    Location
    Jakarta, Indonesia
    Posts
    269

    Re: CAknDialog with grey background

    You must derive your own dialog from CAknDialog.
    There is a lot of example for deriving your own dialog, one that I recall is inside the ImageConverter sample in a class named CShowInfoDialog.
    The ImageConverter sample is available for download in this forum.

    Now after deriving your own dialog, you need to override the
    Code:
            void Draw( const TRect& aRect ) const;
    Inside it just draw a rect that fills the entire screen using a transparent color as show in the snippet below.
    Code:
    		TRgb color(KRgbWhite);
    		color.SetAlpha(204);
    		gc.SetBrushStyle(CGraphicsContext::ESolidBrush);
    		gc.SetBrushColor(color);
    		gc.DrawRect(aRect);
    Now you have covered the whole screen with transparent white (you can change it to transparent grey of course). Add your controls and draw other things like text etc.

  4. #4
    Regular Contributor
    Join Date
    Mar 2007
    Posts
    119

    Re: CAknDialog with grey background

    Wow, I have a problem with dialog and... I stumble upon my own thread:)

    Anyway - I want my dialog to have a skin background. I follow the way you should use CAknsBasicBackgroundControlContext (construction, MopSupplyObject method, resizing etc.). I also know the background should be drawn in the Draw method of the CCoeControl it is placed in (CAknDialog in this case).

    Now here comes the problem. I have defined a void Draw( const TRect& aRect ) const; method in my CAknDialog derived class and... it is not called at all. Thus, I can't draw the background.

    Any idea why the Draw method of CAknDialog is not getting called?

    Thanks

  5. #5
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,684

    Re: CAknDialog with grey background

    It is supposed to be called, and in fact it may do some skinnig for itself: http://developer.symbian.org/xref/os...DIALG.CPP#1581
    Do you enable skinning for your application? (EAknEnableSkin to AppUi::BaseConstructL)

  6. #6
    Regular Contributor
    Join Date
    Mar 2007
    Posts
    119

    Re: CAknDialog with grey background

    Thanks for your answer. Skinning is enabled. That's the source code of CEikDialog, I am using CAknDialog, maybe that's the difference? I did some logging in the Draw method, I even put a Panic and it doesn't crash. What are the most important differences between CEikDialog and CAknDialog?

    My code:

    Code:
    class CMyDlg : public CAknDialog
    {
    ...
    void Draw(const TRect &aRect) const;
    ...
    }
    
    ----
    
    void CMyDlg::Draw(const TRect &aRect) const
    	{
    	User::Panic(_L("Draw"), 1);
    	}

  7. #7
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,684

    Re: CAknDialog with grey background

    If you put CAknDialog into the search box on that page, you will find http://developer.symbian.org/xref/os...dialog.cpp#363 soon. However it is true that the open source code is a few versions later, than what your device is running.
    It may worth checking IsBlank somewhere (construction time is most probably too early for that, try somewhere later).

  8. #8
    Regular Contributor
    Join Date
    Mar 2007
    Posts
    119

    Re: CAknDialog with grey background

    I have taken a look at the CAknDialog source code. IsReadyToDraw() seems to be the key. My dialog returns EFalse in PostLayoutDynInitL() and also later, for example in HandleResourceChange(). That prevents a control from being drawn.

    Any ideas why my dialog wouldn't consider itself ready to be drawn?:)

  9. #9
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,684

    Re: CAknDialog with grey background

    I would not bet on that: if IsReadyToDraw is false, nothing seems to get drawn (including the child controls), you can check its usage in CCoeControl (http://developer.symbian.org/xref/os...c/COECNTRL.CPP), by the way, the method itself is also there.

Similar Threads

  1. [moved] S60 5th Skin background mispositioned
    By sunnyhk in forum Symbian User Interface
    Replies: 0
    Last Post: 2008-11-25, 03:15
  2. How to make the background of a Custom Canvas Transparent
    By markchua_99 in forum Mobile Java General
    Replies: 4
    Last Post: 2008-09-30, 02:57
  3. Graphics in background Python processes?
    By canopus961 in forum Symbian
    Replies: 8
    Last Post: 2008-07-21, 21:31
  4. Replies: 11
    Last Post: 2008-03-28, 08:58
  5. Nokia 6131 + Audio Player Background?
    By andrescm in forum Streaming and Video
    Replies: 0
    Last Post: 2007-10-15, 23:17

Posting Permissions

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