Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » Newbie corner » EditDouble background color
EditDouble background color [message #35520] Fri, 24 February 2012 16:22 Go to next message
idkfa46 is currently offline  idkfa46
Messages: 155
Registered: December 2011
Experienced Member
Hi guys,
here my little problem...
Is possible to change background color in Editfields?

verifica1 = ( 2 * (double)~alzataEdit ) + pedataEdit ;


how can i put a green backround for 62 <= verifica1 <= 64 and a red one for verifica1 > 64 or verifica1 < 62 ?

Regards,
Matteo
Re: EditDouble background color [message #35538 is a reply to message #35520] Mon, 27 February 2012 16:47 Go to previous messageGo to next message
BioBytes is currently offline  BioBytes
Messages: 307
Registered: October 2008
Location: France
Senior Member
Hi Matteo,

I think you should have a look to:

http://www.ultimatepp.org/forum/index.php?t=msg&goto=344 22&S=357a03a3f1a3c9f52db5a30e658007e1&srch=Change+Ed itField+Background#msg_34422

This should help you Rolling Eyes

Regards

Biobytes
Re: EditDouble background color [message #35540 is a reply to message #35538] Tue, 28 February 2012 09:46 Go to previous messageGo to next message
idkfa46 is currently offline  idkfa46
Messages: 155
Registered: December 2011
Experienced Member
oh thanks! that's cool...

EditfieldColour::EditfieldColour()
{
	CtrlLayout(*this, "Window title");

	static EditField::Style sd = ef.StyleDefault();
	sd.paper = Red();
        sd.text = Blue();
        sd.focus = LtRed();
   	ef.SetStyle(sd);
}


I added sd.focus to color background but I really cant understand what sd.paper need for ?!
Re: EditDouble background color [message #35542 is a reply to message #35540] Tue, 28 February 2012 11:06 Go to previous messageGo to next message
BioBytes is currently offline  BioBytes
Messages: 307
Registered: October 2008
Location: France
Senior Member
Hi Matteo,

If I am right, Paper is the colour of background EditField, Text is colour of text and Focus is the colour of text when the control gets focus.

Regards

Biobytes
Re: EditDouble background color [message #35544 is a reply to message #35542] Tue, 28 February 2012 11:33 Go to previous messageGo to next message
idkfa46 is currently offline  idkfa46
Messages: 155
Registered: December 2011
Experienced Member

Oh... god! you're right!
I tryed with just a field and I was always on focus in it

in the end
papar = background color (not on focus)
focus = background color (on focus)

would be useful a way for both cases...

thnx again
Matteo
Re: EditDouble background color [message #35557 is a reply to message #35520] Wed, 29 February 2012 10:14 Go to previous message
idkfa46 is currently offline  idkfa46
Messages: 155
Registered: December 2011
Experienced Member
In the end the background color for Edifields works...
The real problem now is that i cant disable the field or layout comes back to default Sad

here my code:

//scala.h
class Scala : public WithScalaLayout<TopWindow> {
....
public:
EditDouble::Style s;
EditDouble verifica1;
 
	typedef Scala CLASSNAME;
	virtual void Paint (Draw& draw);
	Scala();
};

//main.cpp
void Scala::color(void)
{
	s = verifica1.StyleDefault();
	if(verifica1 < 62 || verifica1 > 64)
		{
			s.paper = LtRed;
 			s.text = Yellow;
		}
	else
		{
			s.paper = LtGreen;
			s.text = Black;
		}
	verifica1.SetStyle(s);
}


I tryed setting s.disabled but nothing happen...
Where I'm wrong now ?!

Thanks,
Matteo
Previous Topic: How can I callback on staticimage click
Next Topic: Ctrl::Quit() and system shutdown
Goto Forum:
  


Current Time: Tue Apr 16 10:23:16 CEST 2024

Total time taken to generate the page: 0.02741 seconds