This document describes the PX1089 diagnostic.
Code | Short Description | Type | Code Fix |
---|---|---|---|
PX1089 | The state of fields and actions cannot be configured in the action delegates. | Error | Unavailable |
The UI presentation logic cannot be configured in the action delegates.
This rule applies to the configuration of PXFieldState
that is performed with the following methods:
- The static
SetVisible
,SetEnabled
,SetRequired
,SetDisplayName
,SetReadOnly
,SetVisibility
, andSetNeutralDisplayName
methods ofPXUIFieldAttribute
- The
SetList
,AppendList
, andSetLocalizable
methods ofPXStringListAttribute
andPXIntListAttribute
- The
SetEnabled
,SetVisible
,SetCaption
, andSetTooltip
methods ofPXAction
The UI presentation logic can be implemented in the following places:
- The
RowSelected
event handler - The constructor of the graph (which can be used for the implementation of the common UI presentation logic; this logic doesn't depend on particular values of the data record)
To prevent the error from occurring, you can move the code that changes the state of the field or action to the RowSelected
event handler or to the graph constructor.
public class SOOrderEntry : PXGraph<SOOrderEntry, SOOrder>
{
public PXSelect<SOOrder> Orders;
public PXAction<SOOrder> Release;
protected virtual IEnumerable release(PXAdapter adapter)
{
Release.SetVisible(false); //The PX1089 error is displayed for this line.
PXUIFieldAttribute.SetEnabled<SOOrder.Hold>(sender, null, false); //Another PX1089 error is displayed for this line.
}
}