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.
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
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?
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
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
Re: how to change the color??
i am getting an WSERV 9 error. what can be the reason for it???
Re: how to change the color??
[QUOTE=chandrasekharan]i am getting an WSERV 9 error. what can be the reason for it???[/QUOTE]
You will get the details of such erros from SDK help.
Here is the description for WSERV 9
[HTML]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.
[/HTML]
reagrds,
Peter
Re: how to change the color??
how do i get out of this WSERV 9 problem?
Re: how to change the color??
[QUOTE=chandrasekharan]how do i get out of this WSERV 9 problem?[/QUOTE]
Hi,
I don't know how to solve this. But there is a point from SDK documentation for WSERV panic
[HTML]Note that some panics are raised in debug builds only.
[/HTML]
so try with device, sometimes it may work in device without this error.
Regards,
Peter
Re: how to change the color??
i will certainly try that...
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();[/CODE]in fact.