Where do I trigger grid.lockcolumn  Topic is solved

Discussions relating to plugin development, and the Jiwa API.

Where do I trigger grid.lockcolumn

Postby perry » Tue Jul 01, 2014 5:54 pm

Jiwa 7.0.65

I cannot find which event I should use for locking/unlocking a column in a grid.

For example on purchase order form
Code: Select all
If Not PO Is Nothing AndAlso PO.OrderStatus <> JiwaApplication.Entities.PurchaseOrder.Workflow.Status.Closed Then
                POUI.LinesJiwaGrid.LockColumn(False, "UserDefinedFloat1")
                POUI.LinesJiwaGrid.LockColumn(False, "UserDefinedFloat2")
                POUI.LinesJiwaGrid.LockColumn(False, "UserDefinedFloat3")
            End If


I tried POUI.BusinessLogic.ReadEnd and it doesn't work (there must be other codes to setup UI after ReadEnd is triggered).
Also tried some other events in POUI.LinesJiwaGrid.ActiveSheet and still no luck

There was a GridLineDisplayed event in JIWA6, is there a similar event in JIWA7?
Perry Ma
S. Programmer
Lonicera Pty Ltd
http://www.lonicera.com.au
perry
Frequent Contributor
Frequent Contributor
 
Posts: 173
Joined: Mon Oct 27, 2008 2:26 pm
Topics Solved: 15

Re: Where do I trigger grid.lockcolumn  Topic is solved

Postby Mike.Sheen » Tue Jul 01, 2014 8:16 pm

Hi Perry,

There is no GridLineDisplayed event in V7 as there was in V6 - But you can achieve what you want without it. You were on the right track in trying to use the ReadEnd event from the business logic - I've managed to do just this and it works for me.

My code is as follows:

Code: Select all
Imports JiwaFinancials.Jiwa
Imports Microsoft.VisualBasic
Imports System.Windows.Forms
Imports System.Data.SqlClient
Imports System.Drawing
Imports System.Data

Public Class FormPlugin
    Inherits System.MarshalByRefObject
    Implements JiwaApplication.IJiwaFormPlugin
            
   Private _POForm As JiwaPurchaseOrdersUI.MainForm

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

    Public Sub SetupBeforeHandlers(ByVal JiwaForm As JiwaApplication.IJiwaForm, ByVal Plugin As JiwaApplication.Plugin.Plugin) Implements JiwaApplication.IJiwaFormPlugin.SetupBeforeHandlers
    End Sub

    Public Sub Setup(ByVal JiwaForm As JiwaApplication.IJiwaForm, ByVal Plugin As JiwaApplication.Plugin.Plugin) Implements JiwaApplication.IJiwaFormPlugin.Setup
      _POForm = DirectCast(JiwaForm, JiwaPurchaseOrdersUI.MainForm)
      AddHandler _POForm.PurchaseOrder.ReadEnd, AddressOf PurchaseOrder_ReadEnd
    End Sub
      
   Public Sub PurchaseOrder_ReadEnd(sender As Object, e As System.EventArgs)
      _POForm.LinesJiwaGrid.LockColumn(False, "UserDefinedFloat1")         
   End Sub
End Class


I'm not sure why your code wasn't working - hard to say without seeing more of how you are adding the handlers. If you were adding your handler in the SetupBeforeHandlers method, rather than the Setup method, then that may explain the behaviour you are seeing. Try the above and let me know how it works out for you.

Mike
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: 2440
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 755

Re: Where do I trigger grid.lockcolumn

Postby perry » Wed Jul 02, 2014 12:15 pm

All good now, thanks.

I was using
Code: Select all
AddHandler POUI.BusinessLogic.ReadEnd, AddressOf POReadEnd

instead of
Code: Select all
AddHandler POUI.PurchaseOrder.ReadEnd, AddressOf POReadEnd


I thought they should behave the same?
Perry Ma
S. Programmer
Lonicera Pty Ltd
http://www.lonicera.com.au
perry
Frequent Contributor
Frequent Contributor
 
Posts: 173
Joined: Mon Oct 27, 2008 2:26 pm
Topics Solved: 15

Re: Where do I trigger grid.lockcolumn

Postby Mike.Sheen » Wed Jul 02, 2014 12:20 pm

perry wrote:All good now, thanks.

I was using
Code: Select all
AddHandler POUI.BusinessLogic.ReadEnd, AddressOf POReadEnd

instead of
Code: Select all
AddHandler POUI.PurchaseOrder.ReadEnd, AddressOf POReadEnd


I thought they should behave the same?


Yes, they are the same. If you change my code to use _POForm.BusinessLogic.ReadEnd instead of _POForm.PurchaseOrder.ReadEnd it will still work - I've just tested this and can confirm this.
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: 2440
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 755

Re: Where do I trigger grid.lockcolumn

Postby perry » Wed Jul 02, 2014 12:23 pm

I must've added the handler in SetupBeforeHandlers yesterday then.

Thanks for help.
Perry Ma
S. Programmer
Lonicera Pty Ltd
http://www.lonicera.com.au
perry
Frequent Contributor
Frequent Contributor
 
Posts: 173
Joined: Mon Oct 27, 2008 2:26 pm
Topics Solved: 15


Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 3 guests

cron