IWbsFieldsRepository.SetFieldPosition Method
Sub SetFieldPosition( _
ByVal field As IWbsField, _
ByVal fieldPlacement As FieldPlacementPosition, _
ByVal referenceField As IWbsField, _
ByVal forUsers As FieldUserScope _
)
This language is not supported or no code example is available.
void SetFieldPosition(
IWbsField field,
FieldPlacementPosition fieldPlacement,
IWbsField referenceField,
FieldUserScope forUsers
)
This language is not supported or no code example is available.
Parameters
- field
- IWbsField
The field whose position will be set.
- fieldPlacement
- FieldPlacementPosition
A position where the field will be placed relative to the referenceField. If the referenceField is null reference (Nothing in Visual Basic) or a non-existent field, this parameter is ignored.
- referenceField
- IWbsField
A field that will serve as a base position for placing the other field according to the fieldPlacement value. If no such field exists, then fieldPlacement is ignored and the fields are placed at the end.
- forUsers
- FieldUserScope
The users this operation will be applied to.
Exception type | Condition |
---|---|
A problem occurred. |
Setting the position of a WBS field may be a difficult task. You can do it directly by setting the IColumnFormatting.ColumnPosition property. But this requires to manually adjust the positions of other affected fields. For example, if you change the position of a field from an old value 10 to a new value 5, you need to increase the positions of all fields that were at positions 5-9 (move them right by one).
There's another problem, if you set the position to an absolute value as mentioned above. You can't do this for multiple users. You can call UpdateField for all users, but the result might be different from what was expected. Each user may have a different layout of WBS fields with totally different field positions. It's impossible to set the fields position to a single value for all users.
That's why this method places the field more naturally, to a position which is relative to the position of another field. For example, if you specify to place "WBS_Description" after "WBS_Unit", it will be displayed after "WBS_Unit" for each user. Even if each user has the "WBS_Unit" at a different position. Of course, all other affected fields are adjusted as well, so this method solves both problems mentioned above.
This method doesn't require a call to UpdateField for the changes to take effect. But once you make all required changes, you should call the IEstimate.CheckAndRepaint method to update the UI.