UnGray function
Syntax
UnGray(scrollpath, target_row, [recordname.]fieldname)
where scrollpath is:
[RECORD.level1_recname, level1_row, [RECORD.level2_recname, level2_row, ]] RECORD.target_recname
To prevent ambiguous references, you can also use SCROLL. scrollname, where scrollname is the same as the scroll level’s primary record name.
Description
Use the Ungray function to make a gray (non-editable) page field editable, if the field was grayed with a call to the Gray function.
Note:
This function remains for backward compatibility only. Use the Enabled field property instead.
If the page field is made display-only in the Page Field Properties dialog, then Ungray has no effect.
The Gray, Ungray, Hide, and Unhide functions usually appear in RowInit programs that set up the initial display of data, and FieldChange programs that change field display based on changes the end user makes to a field.
Generally, you want to put this function on the same scroll level as the field that is being changed in RowInit (which executes on every row) or FieldChange (which executes on the current row). This simplifies the function’s syntax to:
UnGray(FIELDNAME)
A typical use of the more complex syntax is when looping through rows on a scroll on a lower level than the program.
Note:
This function shouldn't be used in any event prior to RowInit.
Parameters
| Parameter | Description |
|---|---|
|
Scrollpath |
A construction that specifies a scroll level in the component buffer. |
|
target_row |
The row number of the target row. If this parameter is omitted, the function assumes the row on which the PeopleCode program is executing. |
|
[recordname .]fieldname |
The name of the field to make editable. The field can be on scroll level one, two, or three of the active page. The recordname prefix is required if the call to Ungray is not on the record definition recordname. |
Returns
Optionally returns a Boolean value indicating whether the function executed successfully.
Example
The following example checks to see if a person’s emergency contact is the same as their home address and phone, then grays or ungrays the fields accordingly. In a typical case, this program would be in the FieldChange event.
If SAME_ADDRESS_EMPL = "Y" Then
Gray(STREET1);
Gray(STREET2);
Gray(CITY);
Gray(STATE);
Gray(ZIP);
Gray(COUNTRY);
Gray(HOME_PHONE);
STREET1 = PERSONAL_DATA.STREET1;
STREET2 = PERSONAL_DATA.STREET2;
CITY = PERSONAL_DATA.CITY;
STATE = PERSONAL_DATA.STATE;
ZIP = PERSONAL_DATA.ZIP;
COUNTRY = PERSONAL_DATA.COUNTRY;
HOME_PHONE = PERSONAL_DATA.HOME_PHONE;
Else
UnGray(STREET1);
UnGray(STREET2);
UnGray(CITY);
UnGray(STATE);
UnGray(ZIP);
UnGray(COUNTRY);
UnGray(HOME_PHONE);
End-If;