Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Control Arrays
Message
From
13/07/2001 16:05:38
 
 
To
13/07/2001 15:48:42
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Title:
Miscellaneous
Thread ID:
00530471
Message ID:
00530482
Views:
19
>How do I create, manipulate, and access control arrays in VFP?
>I've done this in VB but its not clear how (or if) this can be done in VFP.

You can use an a array property. For example,
*!* Off-the-cuff example follows
DEFINE CLASS myObject AS CUSTOM
  DIMENSION oObjects[1]
  oObjects = .NULL.
  PROCEDURE INIT()
    LOCAL lni
    DIMENSION this.oObjects[3]
    WITH this
      FOR lni = 1 TO ALEN( .oObjects )
        .oObjects[lni] = CREATEOBJECT('TextBox')
      NEXT lni
    ENDWITH

    PROCEDURE Destroy
      WITH THIS
        FOR lni = 1 TO ALEN( .oObjects )
          .oObjects[lni] = .NULL.
        NEXT lni
        .oObjects = .NULL.
      ENDWITH 
    ENDPROC
  ENDPROC
ENDDEFINE
Note the destroy method. It's very important to set the object elements to .NULL. before you destroy the parent object, or you'll be left with orphan object references and the form won't release.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform