Sales Order Line Custom field combo not displaying  Topic is solved

Discussions relating to Jiwa 7 plugin development, and the Jiwa 7 API.

Sales Order Line Custom field combo not displaying

Postby indikad » Tue Dec 01, 2015 6:16 pm

I am trying to add ( or import from legacy 6513 ) a Line custom field that is of combo type to the sales order lines
however the combo box does not respond to my clicks ( does not display any values )

see my sample code below
the same code is for a new combo box , but the requirement is for a imported one from 6513 ( I have already moved it to my new plugin from Legacy )
interestingly the grid manager shows the custom field name as PluginName.fieldname

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 CustomField.PluginCustomField.Name = "ALL_CUSTOM_FIELDS.TestCombo" Then ' -- so lines
   If CustomField.PluginCustomField.Name = "TestCombo" Then ' -- so lines
            Dim MyDisplayItems As New List(Of String)
            Dim MyUnderlyingValues As New List(Of String)

            MyDisplayItems.Add("One des")
            MyDisplayItems.Add("Two des")
            MyDisplayItems.Add("Three des ")         
         
      
            MyUnderlyingValues.Add("One")
            MyUnderlyingValues.Add("Two")
            MyUnderlyingValues.Add("Three")      
         

            DirectCast(GridObject.Activesheet.Cells(Row, Col).CellType, FarPoint.Win.Spread.CellType.ComboBoxCellType).EditorValue = FarPoint.Win.Spread.CellType.EditorValue.ItemData
            DirectCast(GridObject.Activesheet.Cells(Row, Col).CellType, FarPoint.Win.Spread.CellType.ComboBoxCellType).Items = MyDisplayItems.ToArray
            DirectCast(GridObject.Activesheet.Cells(Row, Col).CellType, FarPoint.Win.Spread.CellType.ComboBoxCellType).ItemData = MyUnderlyingValues.ToArray
        End If


            DirectCast(GridObject.Activesheet.Cells(Row, Col).CellType, FarPoint.Win.Spread.CellType.ComboBoxCellType).EditorValue = FarPoint.Win.Spread.CellType.EditorValue.ItemData
            DirectCast(GridObject.Activesheet.Cells(Row, Col).CellType, FarPoint.Win.Spread.CellType.ComboBoxCellType).Items = MyDisplayItems.ToArray
            DirectCast(GridObject.Activesheet.Cells(Row, Col).CellType, FarPoint.Win.Spread.CellType.ComboBoxCellType).ItemData = MyUnderlyingValues.ToArray
        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

End Class
indikad
Frequent Contributor
Frequent Contributor
 
Posts: 182
Joined: Thu Jun 18, 2009 1:14 pm
Topics Solved: 2

Re: Sales Order Line Custom field combo not displaying  Topic is solved

Postby Scott.Pearce » Wed Dec 02, 2015 8:26 am

You're putting your code in the "LineCustomFieldPlugin" class right? The sample you provided is for "CustomFieldPlugin".
Scott Pearce
Senior Analyst/Programmer
Jiwa Financials
User avatar
Scott.Pearce
Senpai
Senpai
 
Posts: 765
Joined: Tue Feb 12, 2008 11:27 am
Location: New South Wales, Australia
Topics Solved: 230

Re: Sales Order Line Custom field combo not displaying

Postby indikad » Wed Dec 02, 2015 9:51 am

Scott.Pearce wrote:You're putting your code in the "LineCustomFieldPlugin" class right? The sample you provided is for "CustomFieldPlugin".


hold on! I think that could be it. I will check and get back.
indikad
Frequent Contributor
Frequent Contributor
 
Posts: 182
Joined: Thu Jun 18, 2009 1:14 pm
Topics Solved: 2

Re: Sales Order Line Custom field combo not displaying

Postby Scott.Pearce » Wed Dec 02, 2015 9:52 am

Doh!
Scott Pearce
Senior Analyst/Programmer
Jiwa Financials
User avatar
Scott.Pearce
Senpai
Senpai
 
Posts: 765
Joined: Tue Feb 12, 2008 11:27 am
Location: New South Wales, Australia
Topics Solved: 230

Re: Sales Order Line Custom field combo not displaying

Postby indikad » Wed Dec 02, 2015 10:03 am

Scott -

Moving the code to "LineCustomFieldPlugin" improved a bit - however the code below seems need a change to address line custom fields I think but I dont know how to. The code as is will give me an error - Object Reference Not set to an instance of an Object Module:Format Cell

Code: Select all

            DirectCast(GridObject.Activesheet.Cells(Row, Col).CellType, FarPoint.Win.Spread.CellType.ComboBoxCellType).EditorValue = FarPoint.Win.Spread.CellType.EditorValue.ItemData
            DirectCast(GridObject.Activesheet.Cells(Row, Col).CellType, FarPoint.Win.Spread.CellType.ComboBoxCellType).Items = MyDisplayItems.ToArray
            DirectCast(GridObject.Activesheet.Cells(Row, Col).CellType, FarPoint.Win.Spread.CellType.ComboBoxCellType).ItemData = MyUnderlyingValues.ToArray
indikad
Frequent Contributor
Frequent Contributor
 
Posts: 182
Joined: Thu Jun 18, 2009 1:14 pm
Topics Solved: 2

Re: Sales Order Line Custom field combo not displaying

Postby Scott.Pearce » Wed Dec 02, 2015 10:21 am

This is because of the way the grid assigns cell types. When creating a grid, a cell type is assigned to the column. This does *not* imply, however, that the individual cells also have this cell type - they will use the cell type of the column they belong to UNLESS the celltype of the *CELL* has been explicitly set, in which case the cell uses that. This allows you do do things like make every cell in a column have the same set of say, combo-box items, EXCEPT for a cell here and a cell there where the celltype is overriden.

In any case, you need to do this before your 3 "DirectCast..." lines:

Code: Select all
If GridObject.Activesheet.Cells(Row, Col).CellType Is Nothing Then
    GridObject.Activesheet.Cells(Row, Col).CellType = GridObject.Activesheet.Columns(Col).CellType
End If


See what the code above is doing? It's explicitly setting the cell's type to that of it's owning column, if required.
Scott Pearce
Senior Analyst/Programmer
Jiwa Financials
User avatar
Scott.Pearce
Senpai
Senpai
 
Posts: 765
Joined: Tue Feb 12, 2008 11:27 am
Location: New South Wales, Australia
Topics Solved: 230

Re: Sales Order Line Custom field combo not displaying

Postby indikad » Wed Dec 02, 2015 10:44 am

looks good now - Thanks Scott for the prompt reply.
indikad
Frequent Contributor
Frequent Contributor
 
Posts: 182
Joined: Thu Jun 18, 2009 1:14 pm
Topics Solved: 2


Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 1 guest