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 #3819 is a reply to message #3812] Wed, 28 June 2006 14:06 Go to previous messageGo to next message
fudadmin is currently offline  fudadmin
Messages: 1321
Registered: November 2005
Location: Kaunas, Lithuania
Ultimate Contributor
Administrator
forlano wrote on Tue, 27 June 2006 23:49


I googled "Singleton pattern" and at the end I decided that it is better to use the code without to understand Smile . The topic seems for advanced C++ users while I've started a few monthes ago.
I am a simple user that need widgets that can dialog among them easily and that their properties can be set the same easily. After few monthes U++ thought me to think in the easier, lazier and non verbose way to reach the goal. For this reason sometimes I feel unconfortable and a bit angry, Smile , when some operation need to be done in a too elegant, powerfull and smart way but that I do not understand.
In our case, for example, I would instinctively think about some method like array.SetBgColor(int i, int j) or array.SetPaper(int i, int j) to set the background color of a cell.
Of course I do not know all the environment and my point of view is simply faulty. Nevertheless I am sure that such a direct methods one day not to far will appear Smile.

Luigi


array.SetBgColor(int i, int j) ??? OR:
array.AddColumn("value").SetDisplay(Single<NumbersOnRed>());
I see that as an analogue between plain HTML and CSS.
While I haven't studied to much the Display (or sigleton patterns at all Smile) and my C++ experience is not too much advanced but I think the idea of Display is super great because of flexibility and huge memory savings esp. for big ArrayCtrls? And you can "attach" one property to range of cells.
Each cell (or her "master" -column), instead of keeping and reading properties as members, goes (by following pointers?) to a memory place where sharable property is kept. You could use only SetDisplay(NumbersOnRed) if NumbersOnRed meets the requirements.
But, as I understand, Single ensures (by adding some extra "shape" to that memory place) that there is only one (single) such memory place created when needed.
Is my understanding correct?

Re: ArrayCtrl cell color [message #3820 is a reply to message #3819] Wed, 28 June 2006 14:13 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
BTW, ignoring some subtle MT issues for a moment,

Single<Foo>()

is equivalent to

Foo& SingleFoo()
{
static Foo foo;
return foo;
}

Two things to consider:

- it is one shared instance (object) for all uses

- placing static inside function ensures lazy initialization, in other words, Foo constructor gets called during the first call to SingleFoo.

Mirek
Re: ArrayCtrl cell color [message #3824 is a reply to message #3820] Wed, 28 June 2006 16:26 Go to previous messageGo to next message
forlano is currently offline  forlano
Messages: 1185
Registered: March 2006
Location: Italy
Senior Contributor
luzr wrote on Wed, 28 June 2006 14:13

BTW, ignoring some subtle MT issues for a moment,

Single<Foo>()

is equivalent to

Foo& SingleFoo()
{
static Foo foo;
return foo;
}

Two things to consider:

- it is one shared instance (object) for all uses

- placing static inside function ensures lazy initialization, in other words, Foo constructor gets called during the first call to SingleFoo.

Mirek

Thank you for all your explanations.
I do not doubt it is a great feature, but I need some time to digest it.
BTW, can it be used to set the font of, say, two columns of the ArrayCtrl?

Luigi
Re: ArrayCtrl cell color [message #3825 is a reply to message #3824] Wed, 28 June 2006 16:58 Go to previous message
fudadmin is currently offline  fudadmin
Messages: 1321
Registered: November 2005
Location: Kaunas, Lithuania
Ultimate Contributor
Administrator
forlano wrote on Wed, 28 June 2006 15:26


BTW, can it be used to set the font of, say, two columns of the ArrayCtrl?

Luigi



Please, start a new topic...
Previous Topic: how to set/get data in a composite embedded ctrl in an arrayctrl
Next Topic: Combine Cells?
Goto Forum:
  


Current Time: Sun Apr 28 22:53:20 CEST 2024

Total time taken to generate the page: 0.04234 seconds