Using a view part to list mail in a mail database
The AbtNotesDemoMailView45 sample is supplied to build a fully functional mail client. It consists of a list that displays the ($All) view of the sample mail database and lets you create and edit mail documents with the
AbtLnotesDemoMail45 part. Be aware that the ($All) shows all the documents in the mail database, including draft documents and the calendar entries. The mail part supplied for this sample however is built to edit documents of the Memo type only. If you edit for example a Calendar Entry with the mail part, you may not see all items in the respective note. To avoid this problem, you can supply alternative mail parts (which model other forms) and connect them to the appropriate events of the ViewTable part (see detailed sample description). The view part itself is fairly simple and works much like the other view sample (
Using a view part). You will need the AbtNotesDemoMail45 part to build this sample. If you have not built that sample, perform the steps described in
Using a form part to create and edit mail documents before you proceed.
Step by Step description how to build the sample
1. Select Domino Parts from the parts palette and add a Domino View part to the free form surface. Double-click the view part to open the settings page. From the Alias Name dropdown listbox select the ConTo45SampleMail connection alias. The view part is now reading structural information about the sample database. From the View Name dropdown list select ($All). Select the Error Reporter Creation Automatic check box to make the part ready for automatic error handling. Select OK to close the settings page. You have now configured the view part to represent the ($All) view of the mail sample database.
2. Connect the aboutToOpenWidget event of the main window to the open action of the view part to initialize the part during runtime. Connect the aboutToCloseWidget event of the main window to the close action of the view part to free resources when the program ends.
3. Tear off the database attribute of the view part and place it on the free form surface. From the view parts' pop-up menu use Quick Form and select ViewTable to create a listbox (actually a tree view) to display the views contents in the window. Place the tree view in the main window. Delete the first and the fourth column from the list, because they are used for programming purposes in Domino and need not be displayed.
4. Add three buttons labeled Update, New and Cancel. Connect the clicked event of the Update button to the update action of the view part. Clicking this button will refresh the view index and collapse the view visually. Connect the clicked event of the Cancel button to the closeWidget action of the main window. Before you can connect the New button, we have to add the mail part for editing the mail documents. From the Options menu select the Add part option. Supply the name of the part you created during this sample (or select AbtNotesDemoMail45). As Part type select View wrapper. If you selected your own mail part, you have to promote a feature to make an action available for the use with the mail view.
5. Select Edit part on the view wrapper's context menu. Select the Public interface editor and click on the Promote tag. Add the action named editNote: from the mail part and name it MailPartEditNote:. Save the part and close the window.
6. Now connect the clicked event of the New button to the openWidget event of the view wrapper. Finally, you have to take care that double-clicking a document in the view opens the mail part for editing. Connect the NOTE_Any event of the viewTable to the openWidget action of the view wrapper. Also connect the NOTE_Any event to the promoted feature named MailPartEditNote: of the view wrapper. If you want to make sure that you only edit documents of the Memo type, do not connect the NOTE_Any event but the NOTE_Memo event of the viewTable to the MailPartEditNote: action. You are now ready to test the part. If anything does not work as expected, compare your work with the sample code in AbtNotesDemoApp45.
Last modified date: 01/29/2015