Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Checkbox in Grid is ReadOnly though grid is not
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00229996
Message ID:
00230329
Vues:
25
>As it turns out, I continued to work on work-around, and I messed in the AfterRowColChange event. I didn't think it would have any better hooks to allow the single-click execution I desired, but the following code did the trick:
>
>-------
>LPARAMETERS nColIndex
>
>* Weird grid behavior...sometimes controls get set to readonly for no
>* apparent reason when a cell gets focus. Make sure the control ends up
>* with same ReadOnly status as the column
>LOCAL lcCurrentControl
>lcCurrentControl = 'THIS.Columns[nColIndex].' + ;
> THIS.Columns[nColIndex].CurrentControl
>IF PEMSTATUS(&lcCurrentControl,'ReadOnly',5)
> &lcCurrentControl..ReadOnly = THIS.Columns[nColIndex].ReadOnly
>ENDIF
>--------
>
>This basically just forces the current control of the column to have the same ReadOnly status as the column. So, if you are playing around a lot with multiple controls in a column and really need more intricate control, this won't really work for you.
>
>I still have no idea why my checkboxes are being set to readonly, I just know that the AfterRowColChange event appears to reign over that.

That's a strange one - I've used checkboxes in grids dozens of times now, and never seen that behavior, not just with checkboxes, but *any* column controls. Do you have any other controls in that column, like the default textbox, that might be affecting things?

The way I always use grid checkboxes, though, is with a checkbox in a container dropped into the column, and I set the controlsource in both the column and the checkbox to the logical field. Maybe that stops whatever problem you're seeing.

The reason for the container, BTW, is it allows centering of the checkbox within the column, in case you ever want to do that...
The Anonymous Bureaucrat,
and frankly, quite content not to be
a member of either major US political party.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform