Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Control Arrays In VFP

Status
Not open for further replies.

AllanB1

Programmer
Dec 30, 2002
201
US

Does anyone know of a way to create control arrays on various controls, similarly to the way VB does it?

I know there is a CommandGroup, and obviously OptionGroup, which serve essentially the same purpose, but VB allows you to cut and paste controls such as a TextBox, etc. to create control arrays.

Those of you who have used VB control arrays already realize their benefit.

Thanks all.

Al

 

Sorry, the answer to my question is NO, as I found out in thread 184-399307, which asks the same question. I should have searched first.

However, does anyone know if VFP 8.0 will support control arrays?

Al
 
AllanB1
However, does anyone know if VFP 8.0 will support control arrays?

In a way, yes, it will have a "COLLECTION" class that could hold a collection of controls.
Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Hi AllanB1,

In VFP 8 or VFP7 or VFP6 .. could be earlier as well..

FOR EACH m.oThis IN m.oContainer.Controls
WAIT WINDOW m.Othis.Caption
ENDFOR

or

FOR EACH m.oThis IN ThisForm.Controls
WAIT WINDOW m.Othis.Caption
ENDFOR

Controls is the array collection of the objects contained.
:) ramani :)
(Subramanian.G),FoxAcc, ramani_g@yahoo.com
Happy New Year [bigears] [party] [2thumbsup]

 
COLLECTION class or FOR EACH will both work in the absence of a way to create grouped controls. I was just hoping, I guess, since I'm used to the arrays.

Thanks for responding guys.
 
Is it possible to use Ramani's collection loop

FOR EACH m.oThis IN ThisForm.Controls
WAIT WINDOW m.Othis.Caption
ENDFOR

to just include certain form objects? For example print just the .caption for all labels.

thanks
 
Hi Baileybelle,

Is it possible to use Ramani's collection loop

FOR EACH m.oThis IN ThisForm.Controls
IF m.oThis.BaseClass = "Label"
WAIT WINDOW m.Othis.Caption
ENDIF
IF m.oThis.BaseClass = "TextBox"
WAIT WINDOW m.Othis.Caption
ENDIF
** similar analogy
ENDFOR

You can also think of AMEMBERS() which gives a collection in an array. AMEMBERS .. places the names of properties, procedures, and member objects for an object into a variable array. The syntax is

AMEMBERS(ArrayName, ObjectName | cClassName ;
[, nArrayContentsID] [, cFlags])

Read in the help file as to the parameters and how you can extract member objects, by using nArrayContentsID. :)

:) ramani :)
(Subramanian.G),FoxAcc, ramani_g@yahoo.com
Happy New Year [bigears] [party] [2thumbsup]

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top