Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Adding code to existing grid textboxes
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Vista
Network:
Windows 2003 Server
Database:
Visual FoxPro
Divers
Thread ID:
01241212
Message ID:
01241302
Vues:
27
>>>>Borislav,
>>>>I agree that using my text box class is the best answer but the question is how to change out the existing text box on all columns in over a hundred grids?
>>>
>>>Are you use a Native GRID control (you are doomed if you do so), or you have your own one?
>>
>>All the grids are based on our base grid class but almost all were created with VFP 6.
>That you could change you base Grid class and redefine the control youu sed in the columns to your own, on top of my head, put this in your Grid Base Class Init:
>
>FOR EACH oCol IN this.Columns
>    IF UPPER(oCol.CurrentControl.Class) == [TEXTBOX]
>       oCol.NewObject([MyText],[YourTextBoxClass],[VCX wher class is defined])
>       oCol.RemoveObject([Text1])
>       oCol.CurrentControl = [MyText]
>       oCol.MyText.Visible = .t.
>   ENDIF
>ENDFOR
>
Borislav,
Thanks for the code. I found that
oCol.CurrentControl
is the name and not an object so I added a loop to check each control in the column. This gave me the class name so I can be sure to not change in places I added a custom class. I also added code to use the same text box name. In some of our old stuff we changed the name from text1 sometimes.

It works great thanks again,
John
DoDefault()
*
Local mName, oCol,  oControl
FOR EACH oCol IN this.Columns
  for each oControl in oCol.controls
    if Upper(oControl.class) == 'TEXTBOX'
      mName = oControl.name  && Keep same name
      oCol.RemoveObject(mName)
      oCol.NewObject(mName,[cTextBox],[vjctrl.vcx])
      oCol.CurrentControl = mName
      oCol.Text1.Visible = .t.
    EndIf
  endfor
ENDFOR
Beer is proof that God loves man, and wants him to be happy. - Benjamin Franklin
John J. Henn
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform