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 » U++ Library support » TreeCtrl » Change font color in TreeCtrl
Change font color in TreeCtrl [message #37628] Sun, 28 October 2012 21:31 Go to next message
bushman is currently offline  bushman
Messages: 134
Registered: February 2009
Experienced Member
Simple question: Is it possible to set font color of TreeCtrl? How?
I tried,
struct MyDisplay : public Display {
  virtual void MyDisplay::Paint(Draw& w,const Rect& r,
                                const Value& q,Color ink,
                                Color paper,dword style) const
  {
    w.DrawRect(r, paper);
    w.DrawText(r.left, r.top, text, StdFont(), Blue()); // <- the color I want goes in here
  }
};

...

TreeCtrl tree;
tree.SetDisplay(Single<MyDisplay>());

...

but it does not work: I add items to tree, item text shows fine, but vanish when I SetDisplay(Single<MyDisplay>()). Am I missing something?

Thanks.

Re: Change font color in TreeCtrl [message #37698 is a reply to message #37628] Sun, 04 November 2012 09:02 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
TreeCtrl is using

virtual Size GetStdSize(const Value& q) const;

method, you have to define it for your Display.

E.g.:

Size MyDisplay::GetStdSize(const Value& q) const { return StdDisplay().GetStdSize(q); }
Re: Change font color in TreeCtrl [message #37699 is a reply to message #37698] Sun, 04 November 2012 09:06 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
On second thought, I have changed Display::GetStdSize to call StdDisplay::GetStdSize to avoid this confusion in future... Smile
Previous Topic: PROPOSAL: seperate backend from frontend
Next Topic: OptionTree loses check state when add Callback for the option.
Goto Forum:
  


Current Time: Fri Mar 29 02:04:00 CET 2024

Total time taken to generate the page: 0.01438 seconds