by Mike.Sheen » Sat Dec 05, 2015 10:06 am
You should use the FormatCell method in the CustomFieldPlugin class instead... here's an excerpt from a tile calculator plugin I wrote which sets the decimal places on an inventory custom field named "TileSize":
- Code: Select all
Public Class CustomFieldPlugin
Inherits System.MarshalByRefObject
Implements JiwaApplication.IJiwaCustomFieldPlugin
Public Overrides Function InitializeLifetimeService() As Object
' returning null here will prevent the lease manager
' from deleting the Object.
Return Nothing
End Function
Public Sub FormatCell(ByVal BusinessLogicHost As JiwaApplication.IJiwaBusinessLogic, ByVal GridObject As JiwaApplication.Controls.JiwaGrid, ByVal FormObject As JiwaApplication.IJiwaForm, ByVal Col As Integer, ByVal Row As Integer, ByVal HostObject As JiwaApplication.IJiwaCustomFieldValues, ByVal CustomField As JiwaApplication.CustomFields.CustomField, ByVal CustomFieldValue As JiwaApplication.CustomFields.CustomFieldValue) Implements JiwaApplication.IJiwaCustomFieldPlugin.FormatCell
If TypeOf FormObject Is JiwaInventoryUI.InventoryMaintenanceForm Then
If CustomField.PluginCustomField.Name = "TileSize" Then
' Set decimal places to 6
If GridObject.ActiveSheet.Cells(Row, Col).CellType Is Nothing Then
GridObject.ActiveSheet.Cells(Row, Col).CellType = New FarPoint.Win.Spread.CellType.NumberCellType
End If
DirectCast(GridObject.ActiveSheet.Cells(Row, Col).CellType, FarPoint.Win.Spread.CellType.NumberCellType).DecimalPlaces = 6
End If
End If
End Sub
Public Sub ReadData(ByVal BusinessLogicHost As JiwaApplication.IJiwaBusinessLogic, ByVal GridObject As JiwaApplication.Controls.JiwaGrid, ByVal FormObject As JiwaApplication.IJiwaForm, ByVal Row As Integer, ByVal HostObject As JiwaApplication.IJiwaCustomFieldValues, ByVal CustomField As JiwaApplication.CustomFields.CustomField, ByVal CustomFieldValue As JiwaApplication.CustomFields.CustomFieldValue) Implements JiwaApplication.IJiwaCustomFieldPlugin.ReadData
End Sub
Public Sub ButtonClicked(ByVal BusinessLogicHost As JiwaApplication.IJiwaBusinessLogic, ByVal GridObject As JiwaApplication.Controls.JiwaGrid, ByVal FormObject As JiwaApplication.IJiwaForm, ByVal Col As Integer, ByVal Row As Integer, ByVal HostObject As JiwaApplication.IJiwaCustomFieldValues, ByVal CustomField As JiwaApplication.CustomFields.CustomField, ByVal CustomFieldValue As JiwaApplication.CustomFields.CustomFieldValue) Implements JiwaApplication.IJiwaCustomFieldPlugin.ButtonClicked
End Sub
Mike Sheen
Chief Software Engineer
Jiwa Financials
If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution