Page 1 of 1

Dirty flag on Sales Order

PostPosted: Fri Jan 22, 2016 4:57 pm
by indikad
I am looking to check if the current sales order on the screen is waiting for a save ( "isDirty ?")
for that matter on any screen object would be nice - but sales order window for now.

*I need to do this from a event that is not generated by Sales Order process - such as from a custom button. That is the reason I need the "Dirty" flag.

Thanks.

Re: Dirty flag on Sales Order  Topic is solved

PostPosted: Fri Jan 22, 2016 6:58 pm
by Mike.Sheen
All maintenance type forms have a property, "BusinessLogic" which has a ChangeFlag property.

In your button click handler, use FindForm to get the form (eg: sales order form), and then check the BusinessLogic.ChangeFlag property to see if it is dirty.

i.e.:
Code: Select all
Private Sub MyButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
    Dim form As JiwaApplication.Maintenance.UserInterface = sender.FindForm
    If form.BusinessLogic.ChangeFlag Then
        ' Changes pending
    End If
End Sub

Re: Dirty flag on Sales Order

PostPosted: Wed Jan 27, 2016 12:00 pm
by indikad
Thanks Mike.

Re: Dirty flag on Sales Order

PostPosted: Thu Jan 28, 2016 11:32 am
by indikad
HI Mike,

I had a small issue - when I click my custom button I get an error . the error is
"Public member "findForm" on type "UltraToolsbarsManager" not found. Module - getMembers

However I resolved this by directly accessing the globaly saved sales order form variable rather than using the sender.

Re: Dirty flag on Sales Order

PostPosted: Thu Jan 28, 2016 11:40 am
by Mike.Sheen
indikad wrote:I have a small issue - when I click mu custom button I get an error . the error is
"Public member "findForm" on type "UltraToolsbarsManager" not found. Module - getMembers


The UltraToolsbarsManager is not a control, it is a component and thus has no FindForm property - but you can get to the form using the "DockWithinContainer" property of the UltraToolsbarsManager.

e.g.:
Code: Select all
    Public Sub SalesOrderForm_Toolbar_ToolClick(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinToolbars.ToolClickEventArgs)      
        If e.Tool.Key = "Create Purchase Orders" Then         
         Dim salesOrderForm As JiwaFinancials.Jiwa.JiwaSalesUI.SalesOrder.BaseSalesOrderEntryForm = DirectCast(sender, Infragistics.Win.UltraWinToolbars.UltraToolbarsManager).DockWithinContainer
            CreatePurchaseOrders(salesOrderForm)
        End If
    End Sub


When you mentioned button in your original post, I thought you meant a button control, not a ribbon tool.

Re: Dirty flag on Sales Order

PostPosted: Thu Jan 28, 2016 11:43 am
by indikad
Hi Mike,

thanks It works. - good tip.