The following code illustrates the use of user-defined menus. To make the menus work, you need to create the menu and implement event handlers for your menu commands.
Sub AddVerifyMenu()
'----------------------------------------------------------------------
' Call this function in the AppStartevent in the Verify module.
' Four menus are added.
' The user can send the current form to a supervisor or to a temporary
' queue. The user might change job to the supervisor job or Tom“s job.
'----------------------------------------------------------------------
Call VerifyApp.InitUserDefinedMenu("Queues")
Call VerifyApp.AddMenuItem(ehUserDefinedMenu1, _
"Send form to Supervisor Ctrl+1", _
"CONTROL+1", True, True)
Call VerifyApp.AddMenuItem(ehUserDefinedMenu2, _
"Send form to Tom Ctrl+2", _
"CONTROL+2", True, True)
Call VerifyApp.AddMenuItem(ehUserDefinedMenu3, _
"Switch to Supervisor Ctrl+3", _
"CONTROL+3", True, True)
Call VerifyApp.AddMenuItem(ehUserDefinedMenu4, _
"Switch to Temp Ctrl+4", _
"CONTROL+4", True, True)
End Sub
Function OnAppUserDefined1() As Long
'----------------------------------------------------------------------
' The function is triggered when the user chooses the menu associated
' with menu command no 1 -- that is, when AppUserDefined1
' is fired.
' This function moves the current form to
' queue no 1, and then moves on to the next form.
'----------------------------------------------------------------------
VerifyApp.Form.Queue = ehQueue1
VerifyApp.SkipForm (True)
OnAppUserDefined1 = EV_OK
End Function
Function OnAppUserDefined2() As Long
'----------------------------------------------------------------------
' The function is triggered when the user chooses the menu associated
' with menu command no 2 -- that is when AppUserDefined2 is fired.
' This function moves the current form to
' queue no 2, and then moves on to the next form
'----------------------------------------------------------------------
VerifyApp.Form.Queue = ehQueue2
VerifyApp.SkipForm (True)
OnAppUserDefined2 = EV_OK
End Function
Function OnAppUserDefined3() As Long
'----------------------------------------------------------------------
' The function is triggered when the user chooses the menu associated
' with menu command no 3 -- that is, when AppUserDefined3
' is fired.
' This function stops the currently running job, loads another job and
' starts it.
'----------------------------------------------------------------------
VerifyApp.StopJob
VerifyApp.LoadJob ("C:\FORMS\Samples\jobs\Supervisor.job")
VerifyApp.StartJob
OnAppUserDefined3 = EV_OK
End Function
Function OnAppUserDefined4() As Long
'----------------------------------------------------------------------
' The function is triggered when the user chooses the menu associated
' with menu command no 4 -- that is, when AppUserDefined4
' is fired.
' This function stops the currently running job, loads another job and
' starts it.
'----------------------------------------------------------------------
VerifyApp.StopJob
VerifyApp.LoadJob ("C:\FORMS\Samples\jobs\Tom.job")
VerifyApp.StartJob
OnAppUserDefined4 = EV_OK
End Function