OptionGroup_ Class Properties and Methods

The OptionGroup_ class has two options by default. When you add an OptionGroup object to a form, you can change the number of options by changing the OptionGroup control’s ButtonCount property. If you add options to the OptionGroup, set the additional options’ properties to the properties shown for Option1 and Option2 in the table below.

Properties

The following table lists the class properties. The properties listed include the standard Visual FoxPro class properties that the VPM Enterprise class uses and the VPM Enterprise custom properties. Where appropriate, the Comments column of the table describes a property and provides suggestions for its use.

Property & Initial Value

Comments

Standard Properties Used:

 

BackStyle = 0

 

ButtonCount = 2

 

Height = 60

 

Name = “optiongroup_”

 

Value = 1

 

Width = 100

 

Option1.FontBold = .F.

 

Option1.FontSize = 9

 

Option1.BackStyle = 0

 

Option1.Caption = “Option1”

 

Option1.Value = 1

 

Option1.Height = 22

 

Option1.Left = 15

 

Option1.Top = 8

 

Option1.Width = 75

 

Option1.Name = “Option1”

 

Option2.FontBold = .F.

 

Option2.FontSize = 9

 

Option2.BackStyle = 0

 

Option2.Caption = “Option2”

 

Option2.Value = 0

 

Option2.Height = 22

 

Option2.Left = 15

 

Option2.Top = 30

 

Option2.Width = 75

 

Option2.Name = “Option2”

 

Custom Properties:

 

aValidFilterVariables[1,2]

An array that can be filled with the definition of filter variables that will be set before the validation cursor is created, causing records to be excluded from the cursor. The array is a two-dimensional array that defines the variables used in the WHERE clause of a view or cursoradapter’s SELECT statement. Prior to the cursor being created the variables listed in the array are defined using the name from column 1 and the value from column 2.

cAlias = “”

For data-bound controls whose ControlSource property does not include the cursor alias, the developer should fill-in this property with the alias of field’s cursor. It is used for various purposes, including being passed to the validation routine.

cCSControlID = “”

The two-character ID used to identify the control when setting up Control Security.

cEnabledExpression = “”

Can be filled with an expression that is evaluated by the form’s EnableDisableToolbarControls method as each ISA record is displayed. The result of the evaluation (.T. or .F.) is placed in the form/toolbar control’s Enabled property.

cEnabledOnlyWhenNew Expression = “”

Can be filled with an expression that is evaluated by the form’s EnableDisableControls method when the record that is bound to the control is new. The result of the evaluation (.T. or .F.) is placed in the control’s Enabled property.

cFieldSecurityID = “”

Contains the Field Security ID that is automatically filled-in from the data dictionary in the Init method. Is passed to the When routine to implement view-only Field Security.

cName_DDD = “”

Identifies the DD database/CA library name when different from the database/CA library that can be derived from the alias specified in the ControlSource.

cName_DDF = “”

Identifies the DD field name when different from the field name specified in the ControlSource.

cName_DDTV = “”

Identifies the DD table/view/CA name when different from the table/view/CA alias specified in the ControlSource.

cRGBOptionButtonDisabled ForeColor = “”

The Init method will set the DisabledForeColor property of each OptionButton to the color specified in the OptionGroup’s cRGBOptionButtonDisabledForeColor property.

cRightClick_Menu = “S”+_SCREEN.oApp.cCurPre+”FOPG.MPR”

The name of the right-click shortcut menu to be run.

cValidFilterExpression = “”

Can contain a filter expression to be applied to the validation cursor that is used to validate the control’s value.

cValidRulesID = “”

Passed on to field validation business rules methods and DD validation code snippets so that validation logic can be conditional if necessary, based on this value.

cWhenExpression = “”

Contains the When expression that is automatically filled-in from the data dictionary by the Init event. Is passed to the When routine.

i_cUse_ID = “”

A two-character ID used by the multilingual functionality to provide for the unique translation of a control’s properties.

i_lOverrideControlSource = .F.

Used by the multilingual functionality to bypass the translation of the ControlSource property value.

i_lOverrideDragIcon = .F.

Used by the multilingual functionality to bypass the translation of the DragIcon property value.

i_lOverrideStatusBarText = .F.

Used by the multilingual functionality to bypass the translation of the StatusBarText property value.

lEnableDisableControl = .T.

If .T., means that this control participates in the enabling/disabling of controls by the edit mode.

lEnabledOnlyWhenNew = .F.

If .T., means that the control is only enabled when the record is new, and is disabled after the record has been saved.

lGridOverrideCaption = .F.

If .T., the header caption of the column containing this control will not be overwritten with the grid label (short description) stored in the DD.

lOverrideFieldSecurity = .F.

If .T., the Field Security functionality will be disabled for this control because the cFieldSecurityID property is not filled in with the ID value stored in the DD.

lOverrideWhen = .F.

If .T., the cWhenExpression property value of this control will not be overwritten with the When expression stored in the DD.

oActiveForm = .F.

Since controls can be placed on both forms and toolbars, and since calls are made in the methods of this control to methods of the active form, the oActiveForm property will contain the object reference of the active form.

oDDFRecord = .F.

When data is retrieved from an SDATADDF record for this control, the record is saved as an object to this property.

oDDTVRecord = .F.

When data is retrieved from an SDATADDTV record for this control, the record is saved as an object to this property.

Methods

The following table lists the class methods. The methods listed include the standard Visual FoxPro class methods that the VPM Enterprise class uses and the VPM Enterprise custom methods. Where appropriate, the Comments column of the table describes a method and provides suggestions for its use.

Method

Comments

Standard Methods Used:

 

Destroy

Releases the object references stored in the oActiveForm, oDDFRecord, and oDDTVRecord properties.

Init

Identifies the form associated with this control and places the object reference of the form into the oActiveForm property.

Calls the SetControlProperties method of the active form that fills-in generic control properties.

Finds the SDATADDF and SDATADDTV records for this control and fills-in properties specific to this control, including the oDDFRecord and oDDTVRecord properties.

Sets the DisabledForeColor property of each OptionButton to the color specified in the OptionGroup’s cRGBOptionButtonDisabledForeColor property.

RightClick

Runs the menu specified in the cRightClick_Menu property.

Valid

Runs the field validation routine for the value returned by the IdentifyValidationValue method (by default the value in the Value property of this control).

When

Runs the When routine that returns .T. if this control can receive focus. In determining what value to return, the routine evaluates the When expression from the data dictionary and performs the “Display Only” Field Security check.

Custom Methods:

 

IdentifyActiveForm

Since controls can be placed on both forms and toolbars, and since calls are made in the methods of this control to methods of the active form, this property will contain the object reference of the active form.

IdentifyValidationValue

Called by the Valid event to return the value to be validated. By default, the value in the Value property of the control is returned.

 

More:

PageFrame_ Class Properties and Methods