DannyC wrote:Is it possible to have a Are you Sure? prompt when the user hits the cancel button on the sales order ribbon button?
Yes - it's pretty simple - add a handler for the tool click in the SetupBeforeHandlers (that way your handler gets the click BEFORE the sales order form does), then in that handler just ask the question and throw a new clientcancelled exception to cause the cancellation of the click.
- Code: Select all
Public Sub SetupBeforeHandlers(ByVal JiwaForm As JiwaApplication.IJiwaForm, ByVal Plugin As JiwaApplication.Plugin.Plugin) Implements JiwaApplication.IJiwaFormPlugin.SetupBeforeHandlers
Dim salesOrderForm As JiwaSalesUI.SalesOrder.SalesOrderEntryForm = DirectCast(JiwaForm, JiwaSalesUI.SalesOrder.SalesOrderEntryForm)
AddHandler salesOrderForm.UltraToolbarsManager1.ToolClick, AddressOf UltraToolbarsManager1_ToolClick
End Sub
Private Sub UltraToolbarsManager1_ToolClick(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinToolbars.ToolClickEventArgs)
Dim salesOrderForm As JiwaSalesUI.SalesOrder.SalesOrderEntryForm = DirectCast(sender, Infragistics.Win.UltraWinToolbars.UltraToolbarsManager).DockWithinContainer
Select Case e.Tool.Key
Case "ID_RecordCancel"
If MsgBox("Are you sure?", vbYesNo + vbQuestion, "Confirm Cancel Changes") = vbNo Then
Throw New JiwaApplication.Exceptions.ClientCancelledException
End If
End Select
End Sub
A working sample is attached.
Mike