Unlock freight grid grdCartage  Topic is solved

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

Unlock freight grid grdCartage

Postby DannyC » Wed Jan 12, 2022 1:57 pm

I'm wanting to allow edits of grdCartage for snaps > 1 on Ship Complete orders.

I just can't find the right code to unlock the cells. This is what I have tried so far.
Code: Select all
public void Setup(JiwaFinancials.Jiwa.JiwaApplication.IJiwaForm JiwaForm, JiwaFinancials.Jiwa.JiwaApplication.Plugin.Plugin Plugin)
{
   if (JiwaForm is JiwaFinancials.Jiwa.JiwaSalesUI.SalesOrder.SalesOrderEntryForm)
   {
      JiwaFinancials.Jiwa.JiwaSalesUI.SalesOrder.SalesOrderEntryForm soForm = (JiwaFinancials.Jiwa.JiwaSalesUI.SalesOrder.SalesOrderEntryForm)JiwaForm;
      soForm.SalesOrder.ReadEnd += Attkey_SOReadEnd;
   }
}

private void Attkey_SOReadEnd(object sender, System.EventArgs e)
{
   JiwaFinancials.Jiwa.JiwaSales.SalesOrder.SalesOrder salesOrder = (JiwaFinancials.Jiwa.JiwaSales.SalesOrder.SalesOrder)sender;
   if (salesOrder.BillType == JiwaFinancials.Jiwa.JiwaSales.SalesOrder.SalesOrder.SalesOrderBillTypes.e_SalesOrderShipWhenComplete &&
      salesOrder.CurrentHistoryNo > 1 &&
      salesOrder.SalesOrderStatus != JiwaFinancials.Jiwa.JiwaSales.SalesOrder.SalesOrder.SalesOrderStatuses.e_SalesOrderClosed)
   {
      JiwaFinancials.Jiwa.JiwaSalesUI.SalesOrder.SalesOrderEntryForm soForm = (JiwaFinancials.Jiwa.JiwaSalesUI.SalesOrder.SalesOrderEntryForm)salesOrder.Client;
      soForm.grdCartage.Enabled = true;         //doesn't work
      soForm.grdCartage.LockRow(-1, false);      //doesn't work
      soForm.grdCartage.ActiveSheet.RowHeader.Cells[0,1].Locked = false;     //doesn't work
      soForm.grdCartage.ActiveSheet.RowHeader.Cells[1,1].Locked = false;
      soForm.grdCartage.ActiveSheet.RowHeader.Cells[2,1].Locked = false;
   }
}
User avatar
DannyC
Senpai
Senpai
 
Posts: 718
Joined: Fri Mar 22, 2013 12:23 pm
Topics Solved: 31

Re: Unlock freight grid grdCartage  Topic is solved

Postby Mike.Sheen » Wed Jan 12, 2022 3:25 pm

We normally would use LockColumn to lock or unlock cells of a grid - What made you go down the LockRow and RowHeader path?

To unlock the Ex GST column of the first cartage grid row:
Code: Select all
soForm.grdCartage.LockColumn(false, "ExGST", 0);
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: Unlock freight grid grdCartage

Postby DannyC » Wed Jan 12, 2022 3:47 pm

What made you go down the LockRow and RowHeader path?

Dunno. Just taking pot shots at anything that might work.

I tried your code but couldn't get it to work.

Then I added in a messagebox just to be sure I was entering the code block. No dice there either.
Then I flippin' realised my plugin wasn't enabled! :oops:

All good now. Maybe some of those attempts I made earlier might've worked if the plugin was actually firing but not going back to find out. It works & that's all I care. Thanks again Mike.
User avatar
DannyC
Senpai
Senpai
 
Posts: 718
Joined: Fri Mar 22, 2013 12:23 pm
Topics Solved: 31


Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 1 guest