Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Accessing Form Controls as a Collection
Message
De
03/04/2006 16:32:25
 
 
À
03/04/2006 15:33:00
Joel Whitehead
Ccs Central Computer Services Inc.
Thunder Bay, Ontario, Canada
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Versions des environnements
Visual FoxPro:
VFP 6 SP5
OS:
Windows XP SP2
Divers
Thread ID:
01110059
Message ID:
01110076
Vues:
15
For example, cycle through all the controls on a page, and for any text boxes, set the font to bold, or some such thing. I told him that we would normally create a text box class and have all the text boxes inherit from that. However, it did make me wonder if there is a way to accomplish this similar to how he has described to me.

Add a method to your form called DrillDown and when you call it the first time, pass Thisform to the method. This code in DrillDown() method:
LPARAMETERS toControl
LOCAL loPage, loControl, loColumn
DO CASE
  CASE UPPER( toControl.BaseClass ) = 'PAGEFRAME'
    FOR EACH loPage IN toControl.Pages
      Thisform.DrillDown( loPage )
    ENDFOR

  CASE INLIST( UPPER( toControl.BaseClass ), 'PAGE', 'CONTAINER' )
    FOR EACH loControl IN toControl.Controls
      Thisform.DrillDown( loControl )
    ENDFOR

  CASE UPPER( toControl.BaseClass ) = 'GRID'
    WITH toControl
      FOR EACH loColumn IN .Columns
        FOR EACH loControl IN loColumn.Controls
          *** Do something to the contained controls
        ENDFOR
      ENDFOR
    ENDWITH
  
  CASE INLIST( UPPER( ALLTRIM( toControl.BaseClass ) ), 'COMMANDGROUP', 'OPTIONGROUP' )
    FOR lnButton = 1 TO toControl.ButtonCount
      ThisForm.DrillDown( toControl.Buttons[lnButton] )
    ENDFOR
		
  OTHERWISE
    *** Do what needs doing here
ENDCASE			
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform