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 » ArrayCtrl, HeaderCtrl & GridCtrl » ArrayCtrl cell color
Re: ArrayCtrl cell color [message #3808 is a reply to message #3805] Tue, 27 June 2006 22:06 Go to previous messageGo to previous message
hojtsy is currently offline  hojtsy
Messages: 241
Registered: January 2006
Location: Budapest, Hungary
Experienced Member
forlano wrote on Tue, 27 June 2006 14:13


1) This line is very important:
  array.AddColumn("value").SetDisplay(Single<NumbersOnRed>());

Now, SetDisplay is the method with arguments:
SetDisplay(int i&cedil; int j&cedil; const Display& d)
Instead I see "Single<NumbersOnRed>()" that does the job... but HOW? What is it?


A different SetDisplay is called there. This one:
  
ArrayCtrl::Column& ArrayCtrl::Column::SetDisplay(const Display& d);

The reason for that is that AddColumn does not return a reference to the array, but to the newly added column. You are setting the Display object for the newly added column, and not the whole array.
So this trick is not done by the Single template method. What it does instead is that it returns a reference to an internally stored "singleton" instance of a given type. Search for "singleton pattern" on google for more info about singletons.

forlano wrote on Tue, 27 June 2006 14:13


2) The last stupid question. Is "q" the cell value? Where it has been defined?

The "q" is the cell value, it is defined as a function parameter to the PaintBackground, and Paint methods of Display. The name of the parameter is freely choosen, I put q, because Paint method had it originally this way. The type of q is Value, which is the magical joker type in U++, able to store values of practically any other type. This way the fields of the ArrayCtrl could be Strings, ints, doubles, or even instances of some complex class type.

And: there are no stupid questions.
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: how to set/get data in a composite embedded ctrl in an arrayctrl
Next Topic: Combine Cells?
Goto Forum:
  


Current Time: Tue May 14 05:15:52 CEST 2024

Total time taken to generate the page: 0.01784 seconds