Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Where did Grid.Column0 come from?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00569629
Message ID:
00570239
Vues:
27
The code below demonstrates the problem in what should be close to its simplest form. Believe it or not, this goes all the way back to VFP3...

In this code, the grid class itself is subclassed and dropped on a form, but it also happens is if the grid class is dropped in a container or on a pageframe page, which is then dropped on a form. The columncount must be set to -1 in the grid baseclass, and set in the intermediate class as well for the behavior to occur.

Workaround is to set columncount of grid in grid class (mygrid in the example below) to default, or to 0.

This is a bug, and we know about it already. Someone reported it to VFP support recently.

This code will delete any existing VCX and SCX named testxx.
CLEAR CLASS mygrid
DELETE FILE testxx.vc?
*Create a grid class, set columncount to -1
CREATE CLASS mygrid as grid OF testxx NOWAIT 
= ASELOBJ(la_object,1)
lo_object = la_object[1]
lo_object.columncount = -1

* Uncomment next line for workaround
* lo_object.resettodefault('columncount')
KEYBOARD 'y'
RELEASE WINDOWS "class designer"

*Create a grid subclass, set columncount to something else
LOCAL aobj[1], xx
CREATE CLASS mygrida OF testxx as mygrid FROM testxx NOWAIT 
=ASELOBJ(aobj,1)
aobj[1].columncount = 2
KEYBOARD 'Y' CLEAR
RELEASE WINDOW 'Class Designer'

*Create a form, drop on grid subclass
DELETE FILE testxx.sc?
CREATE FORM testxx NOWAIT
=ASELOBJ(aobj,1)
aobj[1].autocenter = .t.
set classl to testxx.vcx
aobj[1].addobject('mygrid1','mygrida')
set classl to 
KEYBOARD 'Y' CLEAR
RELEASE WINDOW 'Form Designer'

MODIFY FORM testxx NOWAIT 
=ASELOBJ(aobj,1)
?aobj[1].mygrid1.columns[1].name
RETURN 
I hope this helps!
Jim Saunders
Microsoft
This posting is provided “AS IS”, with no warranties, and confers no rights.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform