Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Enable / Disable All Form Controls
Message
De
12/07/2013 12:57:16
 
 
À
12/07/2013 12:28:48
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 7 SP1
OS:
Windows 7
Network:
Windows 2008 Server
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01578324
Message ID:
01578327
Vues:
62
>Greetings All,
>
>Attempting to enable and disable all text boxes in a page frame once the user selects the edit or add button. Here is the code I have in my form method:
>
>DISABLEALL Method:
>
>FOR I = 1 TO THISFORM.CONTROLCOUNT
> IF UPPER(THISFORM.CONTROLS(I).NAME) = [TXT_]
> THISFORM.CONTROLS(I).ENABLED = .F.
> ENDIF
>ENDFOR
>
>But it's not going through those textboxes that are listed throughout the 4 pages of the pageframe. the enableall method is quite naturally the opposite, setting enabled to .T.
>
>How do I set all the controls on the pages of the pageframe?

If all your textboxes are based on the same (or just a few) class(es), use SetAll instead. It drills down.

For example:

This.pgfMyPageFrame.SetAll("Enabled", .F.", "textbox")

Otherwise, you'll need to write code that drills down to do this. Typically, you use a recursive routine to do that. Something like this:
* DisableAll
LPARAMETER oContainer

LOCAL oObject

FOR EACH oObject IN oContainer.Objects FOXOBJECT
   IF UPPER(oObject.Baseclass) = "TEXTBOX"
      oObject.Enabled = .F.
   ENDIF

   * Drill down if this is a container
   IF PEMSTATUS(oObject, "Objects", 5)
      This.DisableAll(oObject)
   ENDIF
ENDFOR
RETURN
Tamar
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform