Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Alternate row colors in a grid
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00128996
Message ID:
00129177
Vues:
21
Ummmm, nearly hard to do!

First, the order tag make different for recno() seq.

2nd, Deleted Records for Set delete on cases!

I suggest to make a new Temp Cursor to simulate the seq. But surely if many
record, this will make the process slow many times!!

Try Code here:
If Set("Delete") = "On"
  Select .F. as rowFlag, field1, field2, field3 ... ;
  from detailtable ...... ;
  Order By CurORderField ;
  into cursor ReadTmp
else
  Select .F. as rowFlag, field1, field2, field3 ... ;
  from detailtable ...... ;
  where .... and !Deleted() ;
  Order By CurORderField ;
  into cursor ReadTmp
endif

  Use DBF('ReadTmp') Again in 0 Alias RWTmp
  Use in ReadTmp
  Select RWTmp  && Read/Write Cursor
  Update RWTmp Set rowFlag = .T. ;
  WHere Recno()%2 = 0

*... Coding to set Grid Color!




First of all, there are many cases, you need to recall the above code:

- Set Delete on/off change
- ORder Tag for table change
- Record are marked deleted when set delete on
- New Record is added
- Master Key Change (Some condition in Where causes changes!)
..... Maybe I miss some cases!

Since This Select-SQL will require 3-5 second(s) for 4~8K data,
it will totally slower the application speed!
Aother thing is you need to consider if empty record or user Un-Add the only record problem....

So, I still suggest you DON'T use this method to do for speed problem.
Anyway, just for a practice is okey!



>Hi Gilles,
>
>I do not think you can use anything that is not orginating from the underlying cursor, that's how DynamicXXX properties have been programmed.
>
>You could add a dummy field to the cursor store the number of the lines as displayed in and use this as an alternative to Recno(). Not sure this is practical in your case of course.
>
>Just a suggestion ...
>
>Marc
>
>
>
>>The only example I have found about this problem uses DynamicBackColor and a test on RECNO().
>>
>>This technique does not work if there is a deleted record that is not displayed, or if the order in which rows are displayed is changed.
>>
>>The only way to get the expected result, no matter how the records are displayed is to use the row number. However, I cannot find any property that would give the row number except only for the active one. Using ActiveRow does not work.
>>
>>Does anybody know how to obtain the correct result?
The weak wait for chance, The strong bid for chance,
The clever notch up chance, but The merciful give you chance.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform