U++ framework
Do not panic. Ask here before giving up.

Home » U++ Library support » Look and Chameleon Technology » A question of C++
Re: A question of C++ [message #20626 is a reply to message #20625] Fri, 27 March 2009 18:39 Go to previous messageGo to previous message
mrjt is currently offline  mrjt
Messages: 705
Registered: March 2007
Location: London
Contributor
You can do both. To set it for a single ctrl you use SetStyle, which overrides StyleDefault() (which may be called something else on some ctrls).

To set it globally you change StyleDefault:
EditField::Style &s = EditField::StyleDefault().Write();
s.paper = Red;
s.focus = Green;
s.ink = Blue;

Incidentally, if you are going to set the style for a single ctrl you need to make sure that the Style instance you are using doesn't run out of scope (or gets deleted) before the Ctrl does. This is because the Ctrl stores a pointer to the Style internally (this is a pretty contrary to Upp style IMO. C'est la vie).
You can use a construct like this to make it work well:
void SetEditStyle(EditField &edit)
{
   static EditField::Style s = EditField::StyleDefault();
   s.paper = Red;
   s.focus = Green;
   s.ink = Blue;
   edit.SetStyle(s);
}
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Custom Font
Next Topic: Questions about themeing plz
Goto Forum:
  


Current Time: Fri May 15 04:16:11 GMT+2 2026

Total time taken to generate the page: 0.00534 seconds