Link to home
Create AccountLog in
Avatar of IainMacb
IainMacbFlag for United Kingdom of Great Britain and Northern Ireland

asked on

.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

            .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?
Avatar of Olaf Doschke
Olaf Doschke
Flag of Germany image

Link to home
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of IainMacb


Each of the columns contains a boringly-standard text entry.

Using version 9.0 SP2.

Will go and look at Highlight.
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.
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.
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:

User generated image
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.
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,