JavaScript Editor js editor     Web development 



Main Page

You can add the following types of objects to a form:

Objects in Visual FoxPro belong in one of two categories, depending on the nature of the class they are based on:

The Form Designer allows you to design both containers and controls.

Container Can contain

Column

Headers, and any objects except form sets, forms, toolbars, timers, and other columns

Command button group

Command buttons

Form set

Forms, toolbars

Form

Page frames, grids, any controls

Grid

Columns

Option button group

Option buttons

Page frame

Pages

Page

Grids, any controls

Collection and Count Properties

All container objects in Visual FoxPro have a count property and a collection property associated with them. The collection property is an array referencing each contained object. The count property is a numeric property indicating the number of contained objects.

The collection and count properties for each container are named according to the type of object that can be contained in the container. The following table lists the containers and the corresponding collection and count properties.

Container Collection Property Count Property

Application

Objects Forms

Count FormCount

FormSet

Forms

FormCount

Form

Objects Controls

Count ControlCount

PageFrame

Pages

PageCount

Page

Controls

ControlCount

Grid

Columns

ColumnCount

CommandGroup

Buttons

ButtonCount

OptionGroup

Buttons

ButtonCount

Column

Controls

ControlCount

ToolBar

Controls

ControlCount

Container

Controls

ControlCount

Control

Controls

ControlCount

These properties allow you to use a loop to programmatically manipulate all or specific contained objects. For example, the following lines of code set the BackColor property of columns in a grid to alternating green and red:

В Copy Code
o = THISFORM.grd1
FOR i = 1 to o.ColumnCount
   IF i % 2 = 0 && Even-numbered column
      o.Columns(i).BackColor = RGB(0,255,0) && Green
   ELSE
      o.Columns(i).BackColor = RGB(255,0,0) && Red
   ENDIF
ENDFOR

See Also



JavaScript Editor js editor     Web development