The Choose Title dialog box provides a way for reviewers to search the FmLib database using text box input as criteria, and to select a title from the search results to critique. The dialog box is a Visual Basic form (frmChooseTitle) that is installed on the client computer as part of LitCritC.dll.
When the on_load event of the enhanced LitCrit form fires, script runs to instantiate the client-side Critique component and a call is made to the ChooseTitle method. The Client-Side Critique COM Component and ChooseTitle Method topics explain how the Choose Title dialog box is shown and describe how the search of the FmLib database is performed. Adding Methods to the Search Component describes the new methods that were added to the Search component (search.cls) to support a search from the Choose Title dialog box.
The reviewer can enter title and author information in two text boxes, select one or all media types, and click Find, OK, or Cancel.
Clicking Find executes a search for items in the FmLib database with titles that match the reviewer entry in the Title text box, authors that match the entry in the Authors text box, and a Media type that is selected. Four variables are declared:
Dim objSearchCML As New TitleMatch
Dim itemFound As FoundTitle
Dim Item As MSComctlLib.ListItem
Dim subItem As MSComctlLib.ListItem
Next, the LoadCollection method of the TitleMatch object is called, passing the reviewer's media selection and the entries in the Title and Authors text boxes as parameters.
objSearchCML.LoadCollection txtTitle.Text, txtAuthors, optMedia(SelectedMedia).Tag, Logon, Server
LoadCollection Method describes how the internal collection object, m_items, of the Visual Basic generic Collection class, is loaded with the search results. The collection (m_items) has a member, an instance of the FoundTitle object (itemFound), for each entry that appears in the lvwSearch ListView control. The code iterates through the collection (m_items) and adds properties from itemFound to Item (a ListItem object) and subitems in the lvwSearch control. The value in the ReviewStatus property determines which icon is displayed. ImageList1, an ImageList control on frmChooseTitle, contains the icon images. The image with the index that matches the ReviewStatus is copied to the SmallIcon property of the ListItem (Item). Title is copied to the text property of the ListItem (Item) and the Authors, MediaType, and Published properties are copied to SubItems(1), (2), and (3) of the Item (a ListItem object).
lvwSearch.ListItems.Clear
For Each itemFound In objSearchCML
With itemFound
Set Item = lvwSearch.ListItems.Add()
Item.SmallIcon = .ReviewStatus
Set Item.Tag = itemFound
Item.Text = .Title
Item.SubItems(1) = .Authors
Item.SubItems(2) = .MediaType
Item.SubItems(3) = .Published
End With
Next
The entire member of the collection (itemFound) is copied to the Tag property of the ListItem to make all the properties (Authors, BibNo, MediaType, ObjectID, Published, ReviewStatus, and Title) from itemFound available to the Choose Title dialog box. Click OK topic describes how these properties are used by code that runs when the reviewer clicks OK or double-clicks an entry in the lvwSearch ListView control.
When the reviewer clicks OK without selecting an entry in the list, the media type and entries in the text boxes, Title and Authors, are copied to the LitCrit Outlook form. The BibNo is set to 0 to indicate no title was chosen and the ObjectId is set to blank indicating no critique was selected.
Title = txtTitle.Text
Authors = txtAuthors.Text
MediaType = optMedia.Item(SelectedMedia).Tag
Me.MediaType = IIf(MediaType = "", "Book", MediaType)
BibNo = 0
ObjectID = ""
If the reviewer selects an entry in the lvwSearch ListView control and then clicks OK — or double-clicks an entry in the ListView control — additional properties (bibNo and ObjectId) from the ListItem (Item) Tag property are copied to the enhanced LitCrit Outlook form. When a reviewer selects a title for which he or she has already submitted a critique that is in the approval process, a message appears stating that the reviewer cannot edit the critique. No properties are copied to the Outlook form and the Choose Title dialog box is not closed.
ObjectID = Item.Tag.ObjectID
' Items that are in process cannot be reviewed
If ObjectID <> "" And Item.SmallIcon = statusInProcess Then
MsgBox "You have recently reviewed '" & Item.Text & _
"' but the review has not yet been approved. " & _
"Please select another item to review.", _
vbExclamation, "Review In Process..."
Exit Sub
End If
The Choose Title dialog box is then unloaded:
Unload Me
Note The same code is executed when the reviewer clicks OK or double-clicks an entry in the list.
When the reviewer clicks Cancel nothing is copied to the LitCrit Outlook form, but the default media type is set to "Book" and the Choose Title dialog box is unloaded.
Me.MediaType = "Book"
Unload Me