Tracy Pearson wrote:
> You want something like this?
> <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>
>   
Hi Tracy/Whil.

Just been playing with this code and got it to work so you can type the 
colours in directly and it will update the background.  This gives you 
more scope if things change (values in a table or you manually updating) 
while you are looking at the grid.  I may use this for one of my forms.

Cheers,

Peter

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 = "evaluate(thisform.getcolour(testing.col1))"
column2.dynamicbackcolor = "evaluate(thisform.getcolour(testing.col2))"
EndDefine

Define Class colorform as Form
datasession = 2
Add Object grid1 as colorgrid
Procedure load
Create Cursor testing (col1 c(15), col2 c(15))
Insert into testing values ("red", "blue")
Insert into testing values ("blue", "red")
Insert into testing values ("green", "yellow")
go top
ENDPROC
FUNCTION getcolour
PARAMETERS cCol
LOCAL cRtn
DO case
CASE LOWER(cCol) = 'red'
    cRtn = "RGB(255,0,0)"
CASE LOWER(cCol) = 'blue'
    cRtn = "RGB(0,0,255)"
CASE LOWER(cCol) = 'green'
    cRtn = "RGB(0,255,0)"
CASE LOWER(cCol) = 'yellow'
    cRtn = "RGB(255,255,0)"
OTHERWISE
    cRtn = "RGB(128,255,255)"
ENDCASE
RETURN cRtn
ENDFUNC
ENDDEFINE




_______________________________________________
Post Messages to: ProFox@leafe.com
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.

Reply via email to