Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How many rows are there in grid?
Message
De
07/07/2008 23:28:06
 
 
À
09/02/2008 07:41:28
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Divers
Thread ID:
01290490
Message ID:
01329655
Vues:
13
Cetin --

A question about a message of yours from half a year ago.

I asked about the use of DynamicFontShadow to determine which is the top record displayed. You suggested calculating it ...

However, I don't think that works when the user has scrolled so that the active record is off the screen, does it? In my particular case, the user has scrolled down along way (the active record is way off the top of the screen). So, recno() doesn't point to a record on the screen ... and using ActivateCell, as I had been doing, jumps the grid back to the current record in the grid.

Any suggestion?

>Fabio is using a simple trick based on the fact that when refresh called Dynamic* properties would be evaluated (and VFP is clever to do that only for visible cells).
>1) He used setvar, you might use anything you want. It's out of the box evaluator w/o a need to have a method/prg to do the job (and m.rowsdata is in its scope)
>2) Yes, irrelevant. You might for example use DynamicFontBold and simply return FontBold.
>3) Yes but as in 1 setvar is out of the box 'prg'
>4) Yes. But you already do with simplier recno() and/or relativerow property.
>
>However, for this you don't even need a trick like this. Just calculate it. Grid has Height, HeaderHeight, RowHeight, ScrollBars properties and Sysmetric() function to arm you with all you need for calculation. Calculating is better IMHO because it doesn't cause, maybe unwanted, refresh to be called (which in turn would call child objects' refresh - I generally don't put any code in refresh but someone may).
>
>Cetin
>
>>That IS interesting. A couple of questions:
>>
>>(1) What in the world is SetVar, and why is is used here?
>>(2) Apparently the value of DynamicFontShadow is irrelevant?
>>(3) Could a call to a PRG be used instead of SetVar?
>>(4) Does this mean I could know which record is the top record displayed (when rowsData = 1)?
>>
>>Jim
>>
>>P.S. I, too, use grids -- they are pervasive in my applications. Couldn't live without them.
>>
>>
>>
>>>>>Is there any way to see total number of non-empty rows in a grid?
>>>>
>>>>You can start with this raw code:
>>>>
>>>>Snipped...
>>>
>>>Hey, that's interesting Fabio. I guess what's going on is VFP is saying, when it refreshes the grid, "There's something in the DynamicFontShadow property, so I need to evaluate the DynamicFontShadow." Then when it does that, the SetVar method is called, which increments the rowsData variable. And DynamicFontShadow is only evaluated for the number of visible rows with data. Now, on the day I need this, will I remember this technique <g> (or should I just put it in my grid class as a method - GetNumberOfVisibleRowsWithData).
Jim Nelson
Newbury Park, CA
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform