Setting up a History List


A history list is useful for backtracking to earlier loaded documents or places previously visited in the same document. From the users point of view, histories are normally accessed as menu items and/or Back/Forward buttons.

The key properties and events relating to history lists are the History, TitleHistory, HistoryIndex, and HistoryMaxCount properties, the ClearHistory method, and the OnHistoryChange event.

1.Set HistoryMaxCount to the number of list items wanted. HistoryMaxCount should be set to 0 if no history list is desired.

2.History (TStrings) will be automatically updated with filenames as files are loaded and positions changed. The History strings may be used as menu items or as listbox contents. Ordering is such that the current file is at index 0.

3.TitleHistory (TStrings) will be automatically updated with document titles as files are loaded and positions changed. The TitleHistory strings may be used as menu items or as listbox contents. Ordering is such that the current file is at index 0.

4.An OnHistoryChange event occurs each time the history list changes. A method responding to this event may be used to determine which buttons and/or menu items are visible, grayed, or checked.

5.The HistoryIndex property may be read to determine which history list item is currently active. Setting of the HistoryIndex property to a new value loads and positions the appropriate file. HistoryIndex can not be set outside the range of the current history list.

6.The ClearHistory method may be used to clear the History List.

For TFrameViewer, History and TitleHistory list only changes in the main document, and HistoryIndex manipulates only the main document history list. However, TFrameViewer maintains an addtional history structure which keeps track of local changes within the Frames of the current main document. The key items for the local history list are the GoFwd and GoBack methods and the FwdButtonEnabled and BackButtonEnabled properties.

7.The GoFwd and GoBack methods should be called by forward and back buttons to move through the local history list. Once the limits of the local history list are reached, these methods will also move through the main history list.

8.The FwdButtonEnabled and BackButtonEnabled properties may be checked in the OnHistoryChange event handler to ascertain if the forward and back buttons should be enabled.