Tracy Pearson wrote:
> You want something like this?
This is the ticket. Took me a bit to figure out why my form wasn't
working similarly; turns out having the cursor 'testing' available
BEFORE the column props are assigned is the reason. Simply creating the
cursor in the init() and then refreshing wasn't working.
Now for a little, er, uh, refactoring, and I should be in good shape!
Thanks!
Whil
> <code>
> Local testform
> testform = CreateObject("colorform")
> testform.show(1)
>
>
> Define Class colorgrid as Grid
> columncount = 2
> height = 200
> left = 24
> top = 18
> width = 320
> column1.dynamicbackcolor = "testing.c1"
> column2.dynamicbackcolor = "testing.c2"
> EndDefine
>
> Define Class colorform as Form
> datasession = 2
> Add Object grid1 as colorgrid
> Procedure load
> Create Cursor testing (col1 c(15), col2 c(15), c1 i, c2 i)
> Insert into testing values ("red", "blue", Rgb(255,0,0), Rgb(0,0,255))
> Insert into testing values ("blue", "red", Rgb(0,0,255), Rgb(255,0,0))
> Insert into testing values ("green", "yellow", Rgb(0,255,0), Rgb(255,255,0))
> EndProc
> EndDefine
> </code>
>
> Whil Hentzen (Pro*) wrote:
>> In a message long, long ago (Feb 07), Sytze asked about changing
>> different grid columns as well as rows with DynamicBackColor:
>>
>> > I have a grid with an INIT like:
>> > thisform.Grid1.SetAll("DynamicBackColor","IIF(calltype="IN",
>> > RGB(192,192,192),RGB(255,255,255))", "Column")
>> >
>> > This give me an easy way to differentiate an IN call from an OUT call,
>> > on different ROWS.
>> >
>> > It looks like this prevents me from having a specific COLUMN in a
>> > different color from the rest. Is this true ?
>>
>> Sietse Wijnker then responded:
>>
>>> The 3rd param in the SetAll method is to specify the class where the
>>> property is set. In this case specifying the column-class isn't needed
>>> because the DynamicBackColor property only applies to the columns.
>>> The SetAll sets all columns DynamicBackColor property to the specified
>>> value. If you want a specific column display in another color, you'll have
>>> to reset the DynamicBackcolor property or at least alter it.
>>> B.T.W. The expression in all the dynamic properties are evaluated in the
>>> scope of the grid, not the column, so using 'this.' in the expression refers
>>> to the grid!
>> I'm trying to take this one step further. I would like to change the
>> backcolor of any cell in a grid. I've got a cursor supporting the grid,
>> with columns named c1, c2, etc., and an array of colors that map to the
>> cursor, like so:
>>
>> col1 col2
>> row1 green red
>> row2 red yellow
>> row3 blue yellow
>>
>> and want to use that as the dynamic back color for each cell in the grid.
>>
>> And I'm close, oh so close....
>>
>> Option 1:
>> thisform.grid.setall("DynamicBackColor", ;
>> "eval(thisform.aCellColor[recn('csrGrid'), ;
>> <some expression>],) ;
>> ")
>>
>> but no matter how much fidgeting I do, I can't get anything to work for
>> 'some expression' that will return the column number in the same manner
>> as recn() works for the row number.
>>
>> Option 2:
>> I've also tried spinning through each column, setting dynamicbackcolor
>> for just that column, but that has no effect:
>>
>> thisform.grid.column1.dynamicbackcolor ;
>> = thisform.aCellColor[recn('csrGrid'),1]
>>
>> but this puts the same color in every row - so column 1 is green for
>> rows 1->3.
>>
>> Ideas?
>>
>>
>
>
[excessive quoting removed by server]
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/[EMAIL PROTECTED]
** All postings, unless explicitly stated otherwise, are the opinions of the
author, and do not constitute legal or medical advice. This statement is added
to the messages for those lawyers who are too stupid to see the obvious.