Custom ComboBox - Sales Order Lines and PO Lines  Topic is solved

Discussions relating to plugin development, and the Jiwa API.

Custom ComboBox - Sales Order Lines and PO Lines

Postby Atronics » Thu Mar 23, 2017 12:52 pm

I have a number of custom ComboBoxes setup in a plugin, all of which work correctly except for SO_Lines and PO_Lines. The combo box appears on the form but does not display a pick list. Is there a setting I need to make to correct this?
Atronics
Frequent Contributor
Frequent Contributor
 
Posts: 119
Joined: Fri Feb 29, 2008 4:40 pm
Topics Solved: 10

Re: Custom ComboBox - Sales Order Lines and PO Lines

Postby Mike.Sheen » Thu Mar 23, 2017 3:23 pm

You need to define in the plugin what items appear in the drop-down.

For Combo custom fields on the lines this is done in the FormatCell method of the LineCustomFieldPlugin class - and that code needs to be present in the same plugin that defines the custom field.

The code is fairly simple - you just need to set the Items and ItemData properties of the cell to be a string array of possible values:

Code: Select all
public void FormatCell(JiwaFinancials.Jiwa.JiwaApplication.IJiwaBusinessLogic BusinessLogicHost, JiwaFinancials.Jiwa.JiwaApplication.Controls.JiwaGrid GridObject, JiwaFinancials.Jiwa.JiwaApplication.IJiwaForm FormObject, int Col, int Row, JiwaFinancials.Jiwa.JiwaApplication.IJiwaLineCustomFieldValues HostItem, JiwaFinancials.Jiwa.JiwaApplication.CustomFields.CustomField CustomField, JiwaFinancials.Jiwa.JiwaApplication.CustomFields.CustomFieldValue CustomFieldValue)
{
   // Set the drop-down items for our custom field
   if (CustomField.PluginCustomField.Name == "ComboTest")
   {
      var itemData = new List<string>() {"10", "20", "30"};
      var itemDisplay = new List<string>() {"Red", "Green", "Blue"};
               
      if (GridObject.ActiveSheet.Cells[Row, Col].CellType == null)
         GridObject.ActiveSheet.Cells[Row, Col].CellType = GridObject.ActiveSheet.Columns[Col].CellType;
      
      FarPoint.Win.Spread.CellType.ComboBoxCellType comboCell = (FarPoint.Win.Spread.CellType.ComboBoxCellType)GridObject.ActiveSheet.Cells[Row, Col].CellType;
   
      comboCell.ItemData = itemData.ToArray();
      comboCell.Items = itemDisplay.ToArray();
   }
}



Sample plugin attached (7.00.175.00).
Attachments
Plugin Sales Order Custom Line Combo.xml
Sample plugin
(29.89 KiB) Downloaded 82 times
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
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2444
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 756

Re: Custom ComboBox - Sales Order Lines and PO Lines  Topic is solved

Postby Atronics » Thu Mar 23, 2017 3:55 pm

Thanks for the prompt reply, Mike. That should get us on our way.
Atronics
Frequent Contributor
Frequent Contributor
 
Posts: 119
Joined: Fri Feb 29, 2008 4:40 pm
Topics Solved: 10


Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 18 guests

cron