Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Problem Refreshing Grid
Message
 
 
À
08/05/2006 09:48:46
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
01120019
Message ID:
01120025
Vues:
23
Ravi,

I think there is some bug here. I discussed the similar problem before.
You may try to add in your click event of the checkbox as the first line
this.value = this.value

Also you can modify your select statement this way
select sum(iif(SendMail,1,0)) as iSelected, sum(iif(SendMail,0,1)) as iNotSelected from myTable into array laTemp

This way you do both operations in one select statement.

>I am using a grid in a form. The record source (alias) for this grid is a cursor cGridSource (created with the Create Cursor command and then appending records that meet selected criteria). The first field in cGridSource cursor is a logical field SendMail and the first column in the grid is a checkbox. The user is allowed to check/uncheck checkboxes in the first column of the grid. I need to display the currently selected rows so I used the following code in the click event of the checkbox in the grid.
>
SELECT  Count(*) as Howmany FROM cGridSource Where sendEmail  INTO CURSOR cDummy
>lnSelected = cDummy.Howmany
>SELECT  Count(*) as Howmany FROM cGridSource Where ! sendEmail  INTO CURSOR cDummy
>lnNotSelected = cDummy.Howmany
>
>and used lnSelected and lnNotSelected to display results. I noticed that though the click event was called every time, the displayed resutls were not correct. (Results were off by 1) I put the code in AfterRowColumnChange, and even at multiple places, e.g. checkbox.click + AfterRowColumnChange, hwoever, I never got correct results. Then I made the following change.
>
lcCode = cGridSource.Code
>llSelected =  cGridSource.sendEmail
>Replace cGridSource.sendEmail  WITH llSelected
>
>SELECT  Count(*) as Howmany FROM cGridSource Where sendEmail  INTO CURSOR cDummy
>lnSelected = cDummy.Howmany
>SELECT  Count(*) as Howmany FROM cGridSource Where ! sendEmail  INTO CURSOR cDummy
>lnNotSelected = cDummy.Howmany
>
>Surprisingly, I always get correct results (The code is only in the Checkbox.click event.) Could someone throw some light on what is happening and what is the correct way of handling this situation. No buffering is used in the form.
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform