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: Display depending by value in other column
ArrayCtrl: Display depending by value in other column [message #34635] Fri, 02 December 2011 17:50 Go to next message
forlano is currently offline  forlano
Messages: 1182
Registered: March 2006
Location: Italy
Senior Contributor
Hello,

with SetDisplay() I can tune the cells of a coloumn.
But now I need to set the color depending by the value got in another column (same row).
How can I get this value when dealing with Display? For example:

arrPlayerRes.AddColumn("Pnt1", t_("Score"), 5).SetDisplay(Single<ColoredStatus>());

arrPlayerRes.AddColumn("RATED", t_("RATED"), 4);

The color in column "Pnt1" should be determined by the value of column "RATED".

Thanks,
Luigi
Re: ArrayCtrl: Display depending by value in other column [message #34641 is a reply to message #34635] Fri, 02 December 2011 21:22 Go to previous messageGo to next message
sergeynikitin is currently offline  sergeynikitin
Messages: 748
Registered: January 2008
Location: Moscow, Russia
Contributor

I send to colored column 2 values from 2 columns:

for example: "2:10"

And in display method :

I split this combined value ( function Split() ) and use 1-st for display value 2-nd for color.


SergeyNikitin<U++>( linux, wine )
{
    under( Ubuntu || Debian || Raspbian );
}
Re: ArrayCtrl: Display depending by value in other column [message #34642 is a reply to message #34641] Fri, 02 December 2011 21:51 Go to previous messageGo to next message
forlano is currently offline  forlano
Messages: 1182
Registered: March 2006
Location: Italy
Senior Contributor
sergeynikitin wrote on Fri, 02 December 2011 21:22

I send to colored column 2 values from 2 columns:

for example: "2:10"

And in display method :

I split this combined value ( function Split() ) and use 1-st for display value 2-nd for color.


Prevet Sergey,

This is a tricky solution that I will use if no other solution will arrive. But I hoped in some more natural way. For example some variable/pointer within Display that has access to the whole row of the ArrayCtrl.
For example the competitor, Smile , GridCtrl use 'parent'. Then parent->Get(MYCOLUMN) permit to get different value in other column. It is a very handy solution .
Each time is a struggle for me to decide wich ctrl to use.

Luigi
Re: ArrayCtrl: Display depending by value in other column [message #34821 is a reply to message #34635] Tue, 13 December 2011 18:52 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
forlano wrote on Fri, 02 December 2011 11:50

Hello,

with SetDisplay() I can tune the cells of a coloumn.
But now I need to set the color depending by the value got in another column (same row).
How can I get this value when dealing with Display? For example:

arrPlayerRes.AddColumn("Pnt1", t_("Score"), 5).SetDisplay(Single<ColoredStatus>());

arrPlayerRes.AddColumn("RATED", t_("RATED"), 4);

The color in column "Pnt1" should be determined by the value of column "RATED".

Thanks,
Luigi



arrPlayerRes.AddColumn("Pnt1", t_("Score"), 5).AddIndex("RATED).SetDisplay(Single<ColoredStatus>());  

arrPlayerRes.AddColumnAt("RATED", t_("RATED"), 4);


Now ColoredStatus will be getting ArrayMap instead of single Value.
Re: ArrayCtrl: Display depending by value in other column [message #34832 is a reply to message #34821] Wed, 14 December 2011 04:53 Go to previous messageGo to next message
Novo is currently offline  Novo
Messages: 1358
Registered: December 2006
Ultimate Contributor
It would be nice to have a list of such "tricks" in a well structured form. Smile Something like FAQ or a place where links to useful posts could be collected. This would make mining knowledge from the forum less time consuming. Smile

Regards,
Novo
Re: ArrayCtrl: Display depending by value in other column [message #34834 is a reply to message #34832] Wed, 14 December 2011 07:23 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
While generally I agree that U++ docs are still wanting, I would say this particular thing is documented quite well:

http://www.ultimatepp.org/src$CtrlLib$ArrayCtrl$en-us.html

(the very first paragraph about indicies and columns).
Re: ArrayCtrl: Display depending by value in other column [message #34843 is a reply to message #34834] Wed, 14 December 2011 11:15 Go to previous messageGo to next message
forlano is currently offline  forlano
Messages: 1182
Registered: March 2006
Location: Italy
Senior Contributor
mirek wrote on Wed, 14 December 2011 07:23

While generally I agree that U++ docs are still wanting, I would say this particular thing is documented quite well:

http://www.ultimatepp.org/src$CtrlLib$ArrayCtrl$en-us.html

(the very first paragraph about indicies and columns).


You are right, of course.
The problem is that sometime one do not give meaning to something until he needs to use it. Although I read that paragraph only after your specific example I understood the meaning of indexes.

Luigi
Re: ArrayCtrl: Display depending by value in other column [message #34844 is a reply to message #34843] Wed, 14 December 2011 11:32 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
OK:

http://www.ultimatepp.org/redmine/issues/220
Re: ArrayCtrl: Display depending by value in other column [message #34850 is a reply to message #34834] Wed, 14 December 2011 22:45 Go to previous messageGo to next message
Didier is currently offline  Didier
Messages: 680
Registered: November 2008
Location: France
Contributor
mirek wrote on Wed, 14 December 2011 07:23

While generally I agree that U++ docs are still wanting, I would say this particular thing is documented quite well:

http://www.ultimatepp.org/src$CtrlLib$ArrayCtrl$en-us.html

(the very first paragraph about indicies and columns).



Well, I have to admit that even after reading the doc I still don't understand what it does Confused
Re: ArrayCtrl: Display depending by value in other column [message #34851 is a reply to message #34821] Thu, 15 December 2011 04:44 Go to previous messageGo to next message
Novo is currently offline  Novo
Messages: 1358
Registered: December 2006
Ultimate Contributor
mirek wrote on Tue, 13 December 2011 12:52

arrPlayerRes.AddColumn("Pnt1", t_("Score"), 5).AddIndex("RATED).SetDisplay(Single<ColoredStatus>());  

arrPlayerRes.AddColumnAt("RATED", t_("RATED"), 4);


Now ColoredStatus will be getting ArrayMap instead of single Value.


Well, documentation for Column::AddIndex() says that "The newly created index is assigned the given identifier.". At the same time documentation for Column::Add() says that it "Adds another source data index to the list of source indices used as the data for the given output column.".

So, based on this documentation I'd use Add() instead of AddIndex().

And there is no notion of getting ArrayMap instead of single Value in documentation.

I understand that documentations is not fun to write and to read. I never write or read it myself. But something like KNOWLEGE BASE, something that in a VERY SHORT FORM lists and describes used concepts and relationships among them would be extremely useful. What is ArrayCtrl made from, how this stuff can be combined, and what will be the outcome. No lyrics, just concepts and relationships. Smile


Regards,
Novo
Re: ArrayCtrl: Display depending by value in other column [message #34852 is a reply to message #34851] Thu, 15 December 2011 08:20 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Agreed. Will try harder Smile
Re: ArrayCtrl: Display depending by value in other column [message #39639 is a reply to message #34821] Thu, 11 April 2013 21:06 Go to previous message
Alexander_Ag is currently offline  Alexander_Ag
Messages: 4
Registered: March 2013
Location: Georgia
Junior Member
Quote:

arrPlayerRes.AddColumn("Pnt1", t_("Score"), 5).AddIndex("RATED).SetDisplay(Single<ColoredStatus>());
this is MAGIC string!

Now ColoredStatus will be getting ArrayMap instead of single Value.

I use:
log.AddRowNumColumn("Name",5).AddIndex(W_ID).SetConvert(Single<ConvertNames>()); 

Now my program works correctly!

[Updated on: Thu, 11 April 2013 21:32]

Report message to a moderator

Previous Topic: [Minor Bug & patch] GridCtrl should use different color to describe inactive cursor.
Next Topic: Grid cursor and its color
Goto Forum:
  


Current Time: Thu Mar 28 20:01:31 CET 2024

Total time taken to generate the page: 0.01615 seconds