.SETALL() method not working on all columns

I'm getting an odd result when using the .SETALL() method in a grid.

I'm trying to highlight the 'current' record. In the .INIT() method for the grid object I've got a line of code that is

    WITH THIS
            .SetAll("DynamicBackColor", ;
                  "IIF( THIS.RecordNumber = RECNO(THIS.RecordSource), c_current, c_normal )", "Column")

The IIF() is handling the moving of the current record, and that works OK.
C_CURRENT and C_NORMAL are the two colours - C_CURRENT is usually highlight yellow while C_NORMAL is usually white, but they can be changed by the user.

Now, what's happening is that I've got 17 columns in the grid. The .SETALL() works OK for the first 14, but not for the last three for some reason.

Any suggestions as to what I'm doing wrong?
LVL 1
IainMacbAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Olaf DoschkeSoftware DeveloperCommented:
You could have current controls in these columns, which don't show the dynamicbackcolor, eg a container would only show the currentbackcolor, if itself is set transparent.

As your expression is highlighting one record, why not make use of the Highlight properties? Which version of V FP are you using?

Bye, Olaf.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
IainMacbAuthor Commented:
Each of the columns contains a boringly-standard text entry.

Using version 9.0 SP2.

Will go and look at Highlight.
IainMacbAuthor Commented:
Have looked at .Highlight and its related properties.

Much simpler solution than .SETALL()! I must have installed .SETALL() years ago and never noticed the alternative - when did it arrive?

New code inserted, all working happily now - many thanks.
Build an E-Commerce Site with Angular 5

Learn how to build an E-Commerce site with Angular 5, a JavaScript framework used by developers to build web, desktop, and mobile applications.

Olaf DoschkeSoftware DeveloperCommented:
Highlight properties were introduced in VFP8 I think, and have improved a little in VFP9.

Much easier for current record highlighting. You can still make use of dynamic color properties, though. The donwside is, the highlight colors don't automatically mix with the other colors to give an overlay/color filter look.

Bye, Olaf.
IainMacbAuthor Commented:
I probably wasn't paying attention to changes in VFP8.

Meanwhile, I see what you mean about the colours. I'm using red to mark negative values - but these disappear in the highlighted row:

Screen capture
Olaf DoschkeSoftware DeveloperCommented:
You may revert to setting the dynamicbackcolor. Setall not working on all columns points out, you may add some columns later than you think. Setall only works on all objects existing at that time, of course. If you reset the recordsource, you get new columns, for example, and they don't "inherit" the settings of already existing columns (they are siblings, not children anyway).

Bye, Olaf.
IainMacbAuthor Commented:
Doh! (to quote Homer Simpson)

I've just looked in more detail at the order in which everything gets called. What I thought was happening - that the grid and its columns gets created and then we call .SETALL() ISN'T what's happening. It's the other way round.

So I've now moved my original .SETALL() code to be in the 'right' place, after the grid and the columns are created. And surprise, surprise, it's all working properly,
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
FoxPro

From novice to tech pro — start learning today.