Page 1 of 1

Sample Plugin for a custom field with a drop down menu

PostPosted: Fri Jun 05, 2015 11:34 am
by Atronics
Mike, for a novice, it is no problem to import the XML file and run the plugin. However, I need to install a combo box custom field into a form other than debtors, which requires some code to be changed. In this case I need the field in Work Order. Could you point me to what parts of the code need to be changed. e.g. the issue seems to be between line 30 and 40

Private _DebtorObject As JiwaDebtors.Debtor

Public Overrides Function InitializeLifetimeService() As Object
' returning null here will prevent the lease manager
' from deleting the Object.
Return Nothing
End Function

Public Sub Setup(ByVal JiwaBusinessLogic As JiwaApplication.IJiwaBusinessLogic, ByVal Plugin As JiwaApplication.Plugin.Plugin) Implements JiwaApplication.IJiwaBusinessLogicPlugin.Setup
_DebtorObject = DirectCast(JiwaBusinessLogic, JiwaDebtors.Debtor)
AddHandler _DebtorObject.CustomFieldValues.Changed, AddressOf CustomFieldValues_Changed

Re: Sample Plugin for a custom field with a drop down menu  Topic is solved

PostPosted: Wed Jun 24, 2015 5:38 pm
by Mike.Sheen
Atronics wrote:Could you point me to what parts of the code need to be changed.


No code actually needs to be changed to make the field appear - just Add a field to the Custom Fields tab on the plugin maintenance for the Work Orders form. Some code is needed to specify which values the user can select, however.

I've re-done the sample to work for work-orders - see attached.

Mike

Plugin Add Combobox custom field to work orders.xml
Sample Plugin
(30.59 KiB) Downloaded 903 times

Re: Sample Plugin for a custom field with a drop down menu

PostPosted: Thu Jun 25, 2015 6:16 pm
by perry
Hi Mike,

Jiwa 7.0.117,

My test plugin as attached, it throws an error at
Code: Select all
DirectCast(GridObject.ActiveSheet.Cells(Row, Col).CellType, FarPoint.Win.Spread.CellType.ComboBoxCellType).EditorValue = FarPoint.Win.Spread.CellType.EditorValue.ItemData

That GridObject.ActiveSheet.Cells(Row, Col).CellType is nothing.

I'm not sure its a coding problem or a bug.


Regards

Re: Sample Plugin for a custom field with a drop down menu

PostPosted: Thu Jun 25, 2015 6:39 pm
by Mike.Sheen
perry wrote:Hi Mike,

Jiwa 7.0.117,

My test plugin as attached, it throws an error at
Code: Select all
DirectCast(GridObject.ActiveSheet.Cells(Row, Col).CellType, FarPoint.Win.Spread.CellType.ComboBoxCellType).EditorValue = FarPoint.Win.Spread.CellType.EditorValue.ItemData

That GridObject.ActiveSheet.Cells(Row, Col).CellType is nothing.

I'm not sure its a coding problem or a bug.


Regards


Hi Perry,

The first problem is that the cell type you defined on the "Custom Fields" tab of the plugin is type checkbox - it needs to be a ComboBox.
The next problem is that the cell type is nothing - I'm pretty sure we make an effort to set that for you - so it should not be null, but fortunately it's easy to work around that - try the attached.

Plugin __test.xml
Revised plugin
(31.93 KiB) Downloaded 770 times


Mike

Re: Sample Plugin for a custom field with a drop down menu

PostPosted: Fri Jun 26, 2015 10:18 am
by perry
Hi Mike,

Thanks,

I forgot to switch the cell type before I export the plugin, was trying to see if cell type was causing issue.

I found in my case all columns' celltype after Col 14 are nothing. Anyway, tested your plugin and all works now.

Regards,