|
|
Home » U++ Library support » ArrayCtrl, HeaderCtrl & GridCtrl » Change row appearance based on column value in that row
|
|
Re: Change row appearance based on column value in that row [message #46815 is a reply to message #46768] |
Tue, 16 August 2016 12:26   |
slashupp
Messages: 231 Registered: July 2009
|
Experienced Member |
|
|
Quote:I guess the basic examples quite shows it:
old-text:
Quote:clear as mud, sorry
i cannot see the link these indexes has with the actual data or different columns
ID1 is used as a stand-alone 'array.AddIndex(ID1);' - where is the relevance? what does it index?
and again as 'array.AddColumn(ID2, ...).Add(ID1)...' - ID2 seems ok, but what is ID1 doing here?
ID3 just seemingly gets AddIndex()ed to the same column as a 'just because got it' - again relevance?, index to what?
do all three indexes here relate to the still-to-be-added-data in this column, whatever it is?
what data is added to the ValueMap?
looking at 'MyConvert()' doesn't help to clarify
looking at 'IdInfo' in 'ArrayCtrl' doesn't either
edit 16/8/23
okay, my attempt at understanding of what is happening:
- an un-attached (akin to a "variable") index is created with AddIndex()
- this index is then attached to some column with Add()
- the index added above will be associated with the value in that column when a row is added
- with a single index Display is called with just that value in that column - which makes no sense at all because it will be called with that value anyway, index or not
- with multiple indexes added to as many columns a ValueMap ([index]->value-in-associated-column)? is created - this seems to make sense - but display-routine magically has to know when its a single or a map? or do i have to in this case always create something like MyConvert?
- multiple indexes to same column - wtf? this throws me completely
array.AddColumn(ID2, "combined").Add(ID1).AddIndex(ID3).SetConvert(Single<MyConvert>());
ID1, ID2, ID3 ALL added to this single column - what am i missing?
in MyConvert you use 0, 1 and 2 as indexes into the ValueArray - what then is the purpose of the named indexes?
[Updated on: Tue, 23 August 2016 10:54] Report message to a moderator
|
|
|
|
Re: Change row appearance based on column value in that row [message #46944 is a reply to message #46815] |
Sun, 25 September 2016 23:52   |
 |
mirek
Messages: 14255 Registered: November 2005
|
Ultimate Member |
|
|
slashupp wrote on Tue, 16 August 2016 12:26
- multiple indexes to same column - wtf? this throws me completely
array.AddColumn(ID2, "combined").Add(ID1).AddIndex(ID3).SetConvert(Single<MyConvert>());
ID1, ID2, ID3 ALL added to this single column - what am i missing?
Well, perhaps it is usefull to state that 'basic' operations are in fact
ArrayCtrl::AddIndex - adds 'index' (or 'column in datagrid')
ArrayCtrl::AddColumnAt - adds visual column which (at first) contains some index
ArrayCtrl::Column::Add - adds another index to the column - in this case, the value of column is ValueMap combining valus of all indices
now other methods are derived. For example
array.AddIndex(ID1);
array.AddColumn(ID2, "combined").Add(ID1).AddIndex(ID3);
can be written using basic ops as
array.AddIndex(ID1);
array.AddIndex(ID2);
array.AddIndex(ID3);
array.AddColumnAt(ID2, "combined").Add(ID1).Add(ID3);
Quote:
in MyConvert you use 0, 1 and 2 as indexes into the ValueArray - what then is the purpose of the named indexes?
Well, ArrayCtrl always creates ValueMap, but in U++, maps are ordered and ValueMap can be converted to ValueArray, that is why it is then possible to use just indexes. But you can convert to ValueMap instead and use IDs or in fact, you can use both IDs or indexes directly for Value (this was not quite possible at the time the example was written).
Hope this helps.
Mirek
|
|
|
|
|
|
|
Goto Forum:
Current Time: Fri Apr 25 19:10:50 CEST 2025
Total time taken to generate the page: 0.01064 seconds
|
|
|