×

Discussion Board

Results 1 to 11 of 11
  1. #1
    Registered User
    Join Date
    Jul 2007
    Posts
    47

    how to change the color??

    i have done a small modification on the existing editor program available with the softwre. here i have added a new menu and 2 submenus. this menu is to change the color of the screen. . i have just added the submenu, to check whether its goin go the loop i habe added some prointf's. it is working, but not done anything to change the color.

    i have given 2 colors. what i want to do is when i click on the blue color submenu the screen should change to blue color. now its the default(white)color. i am currenlty trying the program in emulator. can anybody help me to proceed.

  2. #2
    Registered User
    Join Date
    May 2007
    Location
    Poland
    Posts
    606

    Re: how to change the color??

    Hello
    Everything depends on how do you change background color. Could you give more details?

    If you change pen color and draw rectangle on the screen to change color, don t forget to call drawNow() function which will redraw your screen.

    good luck

  3. #3
    Registered User
    Join Date
    Jul 2007
    Posts
    47

    Re: how to change the color??

    alrite.. i am new to symbian what i am doing is trial and error. will u be able to tell me where i should call this Draw function. is it the below mentioned function that i have to call?
    Draw( const TRect& aRect ) const

    more detials...
    what ever i am doing,i have mentioned in the first query. there is another example which comes with the software named multiviews. i am trying to implement the same thing. is it possible?

  4. #4
    Registered User
    Join Date
    May 2007
    Location
    Poland
    Posts
    606

    Re: how to change the color??

    hey,

    Yes i m talking about that Draw function

    In Draw function write:
    const CFont *ourFont3=CEikonEnv::Static()->TitleFont();
    gc.UseFont(ourFont3);
    gc.SetPenStyle(CGraphicsContext::ESolidPen);
    gc.SetBrushStyle(CGraphicsContext::ESolidBrush);
    gc.SetBrushColor(KRgbBlack);
    gc.DrawRect(TRect(TPoint(0,0),TPoint(176,208)));

    It draws black Rectangle on the screen. If you set different color and call drawNow() function it will redraw your screen

    Good luck

  5. #5
    Regular Contributor
    Join Date
    Nov 2006
    Location
    India
    Posts
    170

    Re: how to change the color??

    Hello,

    FYI-- from sdk documentation
    DrawNow() is implemented by CCoeControl and MAY NOT be overridden. It calls Draw() on the control itself, and also on all its component controls, if it is a compound control.(To do this it uses CountComponentControls() and ComponentControl(), which should be implemented by the derived control class.) If the control is a window-owning control, it also calls Draw() for its child windows (if any).

    regards
    bnvaikos

  6. #6
    Registered User
    Join Date
    Jul 2007
    Posts
    47

    Re: how to change the color??

    i am getting an WSERV 9 error. what can be the reason for it???

  7. #7
    Super Contributor
    Join Date
    Oct 2005
    Posts
    739

    Re: how to change the color??

    Quote Originally Posted by chandrasekharan
    i am getting an WSERV 9 error. what can be the reason for it???
    You will get the details of such erros from SDK help.

    Here is the description for WSERV 9
    HTML Code:
    Attempted to use a non-active graphics context. 
    
    A drawing request was sent to a graphics context when the context was not active. 
    
    On the server side, this panic is raised by CWsGc::CommandL() on all requests received when the context isn’t active except EWsGcOpActivate, EWsGcOpDeactivate, EWsGcOpFree, and EWsGcOpTestInvariant.
    reagrds,
    Peter

  8. #8
    Registered User
    Join Date
    Jul 2007
    Posts
    47

    Re: how to change the color??

    how do i get out of this WSERV 9 problem?

  9. #9
    Super Contributor
    Join Date
    Oct 2005
    Posts
    739

    Re: how to change the color??

    Quote Originally Posted by chandrasekharan
    how do i get out of this WSERV 9 problem?
    Hi,
    I don't know how to solve this. But there is a point from SDK documentation for WSERV panic
    HTML Code:
    Note that some panics are raised in debug builds only.
    so try with device, sometimes it may work in device without this error.

    Regards,
    Peter

  10. #10
    Registered User
    Join Date
    Jul 2007
    Posts
    47

    Re: how to change the color??

    i will certainly try that...

  11. #11
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Budapest, Hungary
    Posts
    28,568

    Re: how to change the color??

    Can it happen that you are invoking Draw for yourself?
    In that case invoke DrawNow instead, which is something like
    Code:
    CWindowGc& gc = SystemGc();
    gc.Activate(*DrawableWindow());
    Draw();
    gc.Deactivate();
    in fact.

Similar Threads

  1. Replies: 5
    Last Post: 2009-10-26, 06:58
  2. How to change CEikTextButton backgroung color
    By bashirpk in forum Symbian
    Replies: 0
    Last Post: 2006-10-04, 07:40
  3. Dynamically change the color of a PNG?
    By ericprat in forum Mobile Java Media (Graphics & Sounds)
    Replies: 13
    Last Post: 2006-04-28, 19:36
  4. Dynamic change background color
    By s2005 in forum Symbian
    Replies: 0
    Last Post: 2005-11-03, 21:37

Posting Permissions

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