Locking or hiding custom fields  Topic is solved

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

Locking or hiding custom fields

Postby SBarnes » Fri Jul 15, 2016 12:13 am

Hi All

Is there a way to lock or even hide custom fields in the sales order screen under specific conditions such as until an order has been saved?
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1696
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 191

Re: Locking or hiding custom fields  Topic is solved

Postby Mike.Sheen » Sun Jul 31, 2016 1:26 pm

Hi Stuart,

The FormatCell methods of the CustomField and CustomLineField classes can we used to lock cells or hide rows.

Attached is an example.

The important bit is shown below:

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.IJiwaCustomFieldValues HostObject, JiwaFinancials.Jiwa.JiwaApplication.CustomFields.CustomField CustomField, JiwaFinancials.Jiwa.JiwaApplication.CustomFields.CustomFieldValue CustomFieldValue)
    {
      if ( CustomField.PluginCustomField.Name == "Test")
      {
         // lock custom field if sales order not saved yet
         var salesOrder = (JiwaFinancials.Jiwa.JiwaSales.SalesOrder.SalesOrder)BusinessLogicHost;
         if (salesOrder.InsertFlag)
         {            
            GridObject.ActiveSheet.Cells[Row, Col].Locked = true;
         }
      }
    }


Mike
Attachments
Plugin Lock Custom Fields.xml
Sample Plugin
(28.62 KiB) Downloaded 609 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: 2583
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 807

Re: Locking or hiding custom fields

Postby SBarnes » Mon Aug 01, 2016 11:47 am

Hi Mike,

Thanks for the help and the example to lock the field, after a little investigation and for the sake of completeness, the row can be hidden by changing

GridObject.ActiveSheet.Cells[Row, Col].Locked = true;

to

GridObject.ActiveSheet.SetRowVisible (Row, false);
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1696
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 191


Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 3 guests