Home > Archive > FoxPro Help and Support > July 2005 > Dynamic backcolor in VFP 8









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Dynamic backcolor in VFP 8
Po

2005-07-05, 7:24 am

Hi,

I'm struggling with the dynamic backcolor property in a grid.
The scope is that I'm comparing values in 2 different tables that are
supposed to have the same values in some of the fields.
Basically, field1, field2, field3 from table A should be identical to
field1, field2, field3 from table B.
I'm selecting the desired fields from the both tables into a cursor,
that then contains A_field1, A_field2, A_field3, B_field1, B_field2,
B_field3 and these six fields are displayed in a grid.
Now, I want to highlight where the differences are.
It could be that A_field1 and A_field2 matches B_field1 and B_field2,
but A_field3 and B_field3 has different values. I then want to make the
backcolor red for that field in the grid so it point out the difference.
I've used the following syntax:
thisform.grid1.column6.DynamicBackColor = IIF(ALLTRIM(A_field3
) =
ALLTRIM(B_field3), 'RGB(168,254,90)', 'RGB(255,0,0)')
I've also tried to use the grid value
(thisform.grid1.column6.text1.value) instead of the cursor value.
However, it takes the value only from the current row (record) and set
this backcolor value for the whole column.

I'd be very grateful if someone could point me in the right direction.
Thanks in advance

Cat Chowdy

2005-07-05, 9:24 am

Don't put quotes around the RBG().

Cat

"Po" <nospam@nospam.org> wrote in message
news:u4h5MkVgFHA.3132@TK2MSFTNGP10.phx.gbl...
> Hi,
>
> I'm struggling with the dynamic backcolor property in a grid.
> The scope is that I'm comparing values in 2 different tables that are
> supposed to have the same values in some of the fields.
> Basically, field1, field2, field3 from table A should be identical to
> field1, field2, field3 from table B.
> I'm selecting the desired fields from the both tables into a cursor,
> that then contains A_field1, A_field2, A_field3, B_field1, B_field2,
> B_field3 and these six fields are displayed in a grid.
> Now, I want to highlight where the differences are.
> It could be that A_field1 and A_field2 matches B_field1 and B_field2,
> but A_field3 and B_field3 has different values. I then want to make the
> backcolor red for that field in the grid so it point out the difference.
> I've used the following syntax:
> thisform.grid1.column6.DynamicBackColor = IIF(ALLTRIM(A_field3
) =
> ALLTRIM(B_field3), 'RGB(168,254,90)', 'RGB(255,0,0)')
> I've also tried to use the grid value
> (thisform.grid1.column6.text1.value) instead of the cursor value.
> However, it takes the value only from the current row (record) and set
> this backcolor value for the whole column.
>
> I'd be very grateful if someone could point me in the right direction.
> Thanks in advance
>



Po

2005-07-05, 9:24 am

Cat Chowdy wrote:
> Don't put quotes around the RBG().
>
> Cat
>
> "Po" <nospam@nospam.org> wrote in message
> news:u4h5MkVgFHA.3132@TK2MSFTNGP10.phx.gbl...
>
>
>
>

Tnx, but that is not the problem. You actually HAVE to put quotes around
them, otherwise you get a "Data type is invalid for this object" error.
Theproblem is that the background property is set for the whole column
instead of each field matching the criteria.
Andrew R

2005-07-05, 9:24 am

You do need quotes, but not where you put them.

If you are putting this in as a line of code in, say, the form.init then you
need the quotes like this.

thisform.grid1.column6.DynamicBackColor = 'IIF(ALLTRIM(A_field
3) =
ALLTRIM(B_field3), RGB(168,254,90), RGB(255,0,0))'

the whole expression has to be quoted.

But if you put this directly into the DynamicBackColor property, at design
time, then you need not quotes at all

IIF(ALLTRIM(A_field3
) = ALLTRIM(B_field3), RGB(168,254,90), RGB(255,0,0))

Andrew R.



"Po" <nospam@nospam.org> wrote in message
news:%23T8f8LWgFHA.2840@tk2msftngp13.phx.gbl...
: Cat Chowdy wrote:
: > Don't put quotes around the RBG().
: >
: > Cat
: >
: > "Po" <nospam@nospam.org> wrote in message
: > news:u4h5MkVgFHA.3132@TK2MSFTNGP10.phx.gbl...
: >
: >>Hi,
: >>
: >>I'm struggling with the dynamic backcolor property in a grid.
: >>The scope is that I'm comparing values in 2 different tables that are
: >>supposed to have the same values in some of the fields.
: >>Basically, field1, field2, field3 from table A should be identical to
: >>field1, field2, field3 from table B.
: >>I'm selecting the desired fields from the both tables into a cursor,
: >>that then contains A_field1, A_field2, A_field3, B_field1, B_field2,
: >>B_field3 and these six fields are displayed in a grid.
: >>Now, I want to highlight where the differences are.
: >>It could be that A_field1 and A_field2 matches B_field1 and B_field2,
: >>but A_field3 and B_field3 has different values. I then want to make the
: >>backcolor red for that field in the grid so it point out the difference.
: >>I've used the following syntax:
: >>thisform.grid1.column6.DynamicBackColor = IIF(ALLTRIM(A_field3
) =
: >>ALLTRIM(B_field3), 'RGB(168,254,90)', 'RGB(255,0,0)')
: >>I've also tried to use the grid value
: >>(thisform.grid1.column6.text1.value) instead of the cursor value.
: >>However, it takes the value only from the current row (record) and set
: >>this backcolor value for the whole column.
: >>
: >>I'd be very grateful if someone could point me in the right direction.
: >>Thanks in advance
: >>
: >
: >
: >
: Tnx, but that is not the problem. You actually HAVE to put quotes around
: them, otherwise you get a "Data type is invalid for this object" error.
: Theproblem is that the background property is set for the whole column
: instead of each field matching the criteria.


Po

2005-07-05, 9:24 am

Andrew R wrote:
> You do need quotes, but not where you put them.
>
> If you are putting this in as a line of code in, say, the form.init then you
> need the quotes like this.
>
> thisform.grid1.column6.DynamicBackColor = 'IIF(ALLTRIM(A_field
3) =
> ALLTRIM(B_field3), RGB(168,254,90), RGB(255,0,0))'
>
> the whole expression has to be quoted.
>
> But if you put this directly into the DynamicBackColor property, at design
> time, then you need not quotes at all
>
> IIF(ALLTRIM(A_field3
) = ALLTRIM(B_field3), RGB(168,254,90), RGB(255,0,0))
>
> Andrew R.
>
>
>
> "Po" <nospam@nospam.org> wrote in message
> news:%23T8f8LWgFHA.2840@tk2msftngp13.phx.gbl...
> : Cat Chowdy wrote:
> : > Don't put quotes around the RBG().
> : >
> : > Cat
> : >
> : > "Po" <nospam@nospam.org> wrote in message
> : > news:u4h5MkVgFHA.3132@TK2MSFTNGP10.phx.gbl...
> : >
> : >>Hi,
> : >>
> : >>I'm struggling with the dynamic backcolor property in a grid.
> : >>The scope is that I'm comparing values in 2 different tables that are
> : >>supposed to have the same values in some of the fields.
> : >>Basically, field1, field2, field3 from table A should be identical to
> : >>field1, field2, field3 from table B.
> : >>I'm selecting the desired fields from the both tables into a cursor,
> : >>that then contains A_field1, A_field2, A_field3, B_field1, B_field2,
> : >>B_field3 and these six fields are displayed in a grid.
> : >>Now, I want to highlight where the differences are.
> : >>It could be that A_field1 and A_field2 matches B_field1 and B_field2,
> : >>but A_field3 and B_field3 has different values. I then want to make the
> : >>backcolor red for that field in the grid so it point out the difference.
> : >>I've used the following syntax:
> : >>thisform.grid1.column6.DynamicBackColor = IIF(ALLTRIM(A_field3
) =
> : >>ALLTRIM(B_field3), 'RGB(168,254,90)', 'RGB(255,0,0)')
> : >>I've also tried to use the grid value
> : >>(thisform.grid1.column6.text1.value) instead of the cursor value.
> : >>However, it takes the value only from the current row (record) and set
> : >>this backcolor value for the whole column.
> : >>
> : >>I'd be very grateful if someone could point me in the right direction.
> : >>Thanks in advance
> : >>
> : >
> : >
> : >
> : Tnx, but that is not the problem. You actually HAVE to put quotes around
> : them, otherwise you get a "Data type is invalid for this object" error.
> : Theproblem is that the background property is set for the whole column
> : instead of each field matching the criteria.
>
>

That did the trick! Thanks Andrew!
Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com