Coming soon: Your brand new Help Center & Community! Get a sneak-peek here

8.0 Changes to the Script Events system

8.0 has a few new script events as well as possibly some breaking changes.

When working with script events I suggest you:

Turn on the preference for Funtions/Enable script developer mode and restart.
Use the viewer from the Script utils menu to look at the traffic.

(NB:  Some of these changes have not yet made it into the SoEventServer system, beta3, only the in-process script event system)

New/Changed:

- OnCurrentDiaryOwnerIdentityChanged

- OnCurrentDiaryOwnerFieldChanged

     > OnDiaryOwnerFieldsChanged (1)  [VT_BSTR] SetPostItText, [VT_UI4]3, [VT_BSTR] text, [VT_INT]4616

 

- OnPrePhoneDial

    > OnPrePhoneDial (0)  [VT_BSTR] 00 31 4444444444, [VT_INT]6, [VT_INT]22, [VT_I2] 1

    Phone number, OwnerTable Id, Owner Id, Phone internal Id

- OnPhoneDialed

   > OnPhoneDialed (1)  [VT_BSTR] 00 31 4444444444

 

- OnPreCopySoProtocol

  >  OnPreCopySoProtocol (0)  [VT_BSTR] superoffice:diary.activityarchive.day.minimonth?db_id=1010000014&diaryowner_id=11&tzlocation_key=GL2&day_date=2015.10.28&edit

 

 

Removed (see complete list here under)

All *MailMerge* events. Mail merge has been replaced by Mailings. This is a CS module running inside a browser panel.

All  Dialog~, Panel~ and View~ Shown/Closed messages. These have been replaced by a generic system pluged into the GUI framework using a View's NamedControlText. 

You are now garanteed to recieve in a well defined order the following messages upon any View change where a NamedControlText exists; example from the viewer should make this clear:

2: 20:26:35:658 OnViewPreShow (1) [VT_I4] 9315156, [VT_BSTR] AppointmentDialog
3: 20:26:35:661 OnViewPreShow (1) [VT_I4] 1778512, [VT_BSTR] AppointmentDialog.AppointmentDialogDescriptionView
4: 20:26:36:962 OnViewShown (1) [VT_I4] 9315156, [VT_BSTR] AppointmentDialog
5: 20:26:36:965 OnViewShown (1) [VT_I4] 1778512, [VT_BSTR] AppointmentDialog.AppointmentDialogDescriptionView
6: 20:26:40:437 OnViewPreHide (1) [VT_I4] 1778512, [VT_BSTR] AppointmentDialog.AppointmentDialogDescriptionView
7: 20:26:40:441 OnViewPreHide (1) [VT_I4] 9315156, [VT_BSTR] AppointmentDialog
8: 20:26:40:476 OnViewHidden (1) [VT_I4] 1778512, [VT_BSTR] AppointmentDialog.AppointmentDialogDescriptionView
9: 20:26:40:483 OnViewHidden (1) [VT_I4] 9315156, [VT_BSTR] AppointmentDialog
10: 20:26:43:690 OnViewPreShow (1) [VT_I4] 1058236, [VT_BSTR] ContactPanel.ContactCardUdefView
11: 20:26:43:742 OnViewShown (1) [VT_I4] 1058236, [VT_BSTR] ContactPanel.ContactCardUdefView
12: 20:26:43:750 OnViewPreHide (1) [VT_I4] 1713274, [VT_BSTR] ContactPanel.ContactCardMainView
13: 20:26:43:756 OnViewHidden (1) [VT_I4] 1713274, [VT_BSTR] ContactPanel.ContactCardMainView
14: 20:26:43:798 OnViewPreHide (1) [VT_I4] 1650192, [VT_BSTR] ContactPanel.PreviewMiniCardView
15: 20:26:43:803 OnViewHidden (1) [VT_I4] 1650192, [VT_BSTR] ContactPanel.PreviewMiniCardView
16: 20:26:43:808 OnViewPreShow (1) [VT_I4] 1650192, [VT_BSTR] ContactPanel.PreviewMiniCardView
17: 20:26:43:813 OnViewShown (1) [VT_I4] 1650192, [VT_BSTR] ContactPanel.PreviewMiniCardView
18: 20:26:43:817 OnViewPreHide (1) [VT_I4] 1450752, [VT_BSTR] ContactPanel.SmartMonthMiniCardView
19: 20:26:43:821 OnViewHidden (1) [VT_I4] 1450752, [VT_BSTR] ContactPanel.SmartMonthMiniCardView
20: 20:26:48:635 OnViewPreShow (1) [VT_I4] 1121312, [VT_BSTR] SalePanel
21: 20:26:48:647 OnViewPreShow (1) [VT_I4] 1122266, [VT_BSTR] SalePanel.SaleCardMainView
22: 20:26:48:658 OnViewPreShow (1) [VT_I4] 1451136, [VT_BSTR] SalePanel.SaleArchiveActivitiesView
23: 20:26:48:745 OnViewShown (1) [VT_I4] 1121312, [VT_BSTR] SalePanel
24: 20:26:48:754 OnViewShown (1) [VT_I4] 1122266, [VT_BSTR] SalePanel.SaleCardMainView
25: 20:26:48:760 OnViewShown (1) [VT_I4] 1451136, [VT_BSTR] SalePanel.SaleArchiveActivitiesView
26: 20:26:48:767 OnViewPreHide (1) [VT_I4] 1058236, [VT_BSTR] ContactPanel.ContactCardUdefView
27: 20:26:48:772 OnViewPreHide (1) [VT_I4] 1189252, [VT_BSTR] ContactPanel.ContactArchivePersonsView
28: 20:26:48:781 OnViewPreHide (1) [VT_I4] 1846110, [VT_BSTR] ContactPanel.PreviewMiniCardView.PersonMiniCardView
29: 20:26:48:787 OnViewPreHide (1) [VT_I4] 1650192, [VT_BSTR] ContactPanel.PreviewMiniCardView
30: 20:26:48:795 OnViewPreHide (1) [VT_I4] 1189664, [VT_BSTR] ContactPanel
31: 20:26:48:806 OnViewHidden (1) [VT_I4] 1058236, [VT_BSTR] ContactPanel.ContactCardUdefView
32: 20:26:48:814 OnViewHidden (1) [VT_I4] 1189252, [VT_BSTR] ContactPanel.ContactArchivePersonsView
33: 20:26:48:820 OnViewHidden (1) [VT_I4] 1846110, [VT_BSTR] ContactPanel.PreviewMiniCardView.PersonMiniCardView
34: 20:26:48:826 OnViewHidden (1) [VT_I4] 1650192, [VT_BSTR] ContactPanel.PreviewMiniCardView
35: 20:26:48:832 OnViewHidden (1) [VT_I4] 1189664, [VT_BSTR] ContactPanel

The int param is the HWND handle, the string is a full path made up of NamedControlTexts.
These messages never lie! As soon as we give a new View a NamedControlText, a contract we have to honour anyway, it will show up here.
Offcourse you are going to have to make your own dispatcher based on the view path.

 

Complete list of removed messages:
 

OnPersonDialogShown
OnAppointmentDialogShown
OnDocumentDialogShown
OnParticipantDialogShown
OnInvitationsDialogShown
OnFindDateDialogShown
OnAlarmDialogShown
OnParticipantDialogDone
OnExternalUsersDialogShown

OnPersonDialogClosed
OnRelationDialogClosed
OnAppointmentDialogClosed
OnDocumentDialogClosed
OnExternalUsersDialogClosed


OnContactPanelShown
OnDiaryPanelShown
OnProjectPanelShown
OnSalePanelShown
OnSelectionPanelShown
OnEmailPanelShown

OnProjectMailmergeTaskClicked
OnSelectionMailmergeTaskClicked
OnSelectionMailMergeStart
OnSelectionMailMergeDocument
OnSelectionMailMergeEmailSend
OnSelectionMailMergeEnd
OnDialogShown
OnDialogClosed

OnQuoteDialogViewShown
OnQuoteLineDialogViewShown

OnFindContactViewShown
OnFindPersonViewShown
OnFindProjectViewShown
OnFindSaleViewShown
OnFindSelectionViewShown
OnFindAppointmentViewShown
OnFindDocumentViewShown
OnFindRequestViewShown
OnFindQuotelineViewShown

OnFindFreetextContactViewShown
OnFindFreetextPersonViewShown
OnFindFreetextProjectViewShown
OnFindFreetextSaleViewShown
OnFindFreetextSelectionViewShown
OnFindFreetextAppointmentViewShown
OnFindFreetextDocumentViewShown

To be removed/cleaned-up:

The Quote events are still very much in an amputated state.
Many will show up under the  Known events tab of the viewer but they stopped being called when Win adopted more and more of the Netserver Quote service layer.
The only entity that still has a virtually complete classic event system is the QuoteLineModel.
But to be honest, I am not sure where this will go.
We want you to use the netserver Quote Service layer events. 

If you have any questions, don't hesitate to post them here!
Conrad 

RE: 8.0 Changes to the Script Events system

ALL WINDOW SCRIPT WRITERS MUST READ THIS!!!

 

Bumping this in the activity stream...

Af: Tony Yates 29. okt 2015

RE: 8.0 Changes to the Script Events system

Hi!

 

I have the following script that has stopped working in SO8: 

Public Sub OnCurrentDocumentFieldChanged(fieldname)
if fieldname = "appointment.task_idx" Then
UpdateHeader()
End if
End Sub

Public Sub OnDocumentDialogShown()
UpdateHeader()
End Sub

...

OnCurrentDocumentFieldChanged works fine, but OnDocumentDialogShown does not since it has been removed. 

I need an example of how i am supposed to use OnViewPreShow to envoke my subroutine as i did with OnDocumentDialogShown in SO75. 

Af: Lars Madsen 4. jun 2017

RE: 8.0 Changes to the Script Events system

Sub OnCurrentDocumentFieldChanged( fieldName )
    If StrComp( fieldName, "appointment.task_idx", vbTextCompare ) = 0 Then
        UpdateHeader( "TaskIdx changed" )
    End If
End Sub

Sub OnViewShown( hWnd, fullPath )
    If StrComp( fullPath, "MainWindow.DocumentDialog", vbTextCompare ) = 0 Then
        UpdateHeader( "Document dialog shown" )
    End If
End Sub

Sub UpdateHeader( msg )
    SOMessageBox msg, "A condition is met", 2
End Sub

Conrad

NB: Use the script event viewer to see what the fullPath are.
Observe: when testing for field names, you should use case insensitive comparisons.

 

Alt, a useful short hand:

Function EndsWith( what, withWhat )
    EndsWith = StrComp( Right( what, Len(withWhat) ), withWhat, 1 ) = 0
End Function

Sub OnViewShown( hWnd, fullPath )
    If EndsWith( fullPath, "DocumentDialog" ) = vbTrue Then
        UpdateHeader( "Document dialog shown" )
    End If
End Sub

Af: Conrad Weyns 4. jun 2017

RE: 8.0 Changes to the Script Events system

Thanks Conrad!

Thats excatly the info I was looking for!  :-)

Af: Lars Madsen 4. jun 2017