gbHTMLNavigator
gbHTMLNavigator demonstrates the various ways that a PowerBASIC application can allow the
user to navigate within a single HTML document. The user's default browser already has some methods
for general purpose navigation. But a programmer can design their HTML document in ways that takes
advantage of how PowerBASIC can interact with a HTML document, providing the user with even more
powerful features.
The following image of gbHTMLNavigator contains an HTML document that is index for my
100 page PowerBASIC tutorial. The document lists 6 Chapters, each with a half dozen or so Sections.
The main toolbar of gbHTMLNavigator provides ways to quickly browse, jump, search, or highlight
specified information on the page.
In this case, the document is just a vehicle to highlight the features a programmer can add
to a PowerBASIC application. The type of HTML document you create is limited only by your
imagination (tables, lists, paragraphs, images, ...). But regardless of the document content,
PowerBASIC can interact with the browser to enhance your user's ability to work with the
information presented.
Additionally, a web browser context menu is available.
Feature List
gbHTMLNavigator demonstrates many different wat to search, navigate, and acquire document content.
- Find Dialog
gbHMTLNavigator can call up the web browser's built-in Find dialog
- Highlight Terms
Highlighting of terms can also be done without the use of the Find dialog.
gbHTMLNavigator allows the user to type in a text string, consisting of one
or more terms:
gbHTMLNavigator can then highlight all of the terms, as in this image:
Highlighting or terms and phrases can be customized with the following options:
Match - highlights terms that match the case. In this example, "Chapter" was
the search term. Note that lower case chapter is not highlighted.
Word - highlights whole words only (no partial words). IN this example,
"Chapter" was the search term. Not that the "chapter" in "chapters" is not highlighted.
Exact - highlights a single string, exactly as typed by the user. In
this example, the phrase "Introductory Chapter" was typed in. In this case, Match
was not selected, so case was ignored:
Any combination of the Match/Word/Exact settings may be used to customize which
words are highlighted.
- Previous/Next navigation based on HTML tags
Jumps from one Chapter to the next, or from one Section to the next.
This is done by examining the internal HTML code, finding matches according to how the
application is coded. When desired HTML elements are found, the visible code associated
with the elements is highlighted.
- GoTo Chapter
Opens a custom inputbox, allowing the user to specify a Chapter #. gbHTMLNavigator
will jump directly to that Chapter. Use the keyboard shortcut Ctl-G to display the dialog.
This also works by searching internal HTML elements,
then moving to and highlighting the element of choice.
- Jump to Top/Bottom
Scrolls to the top or bottom of the browser window.
These commands have the same effects as
Ctrl-Home and Ctrl-End, but is done programmatically on the click of a toolbar button.
- Extract all/selected document text
gbHTMLNavigator can copy all text (minus the HTML code) to the clipboard without first selecting the
text. It can also copy just the selected text.
- Customized Context Menu
gbHTMLNavigator can be set to display the default web browser context menu, or it can be set
to display a custom menu which consists of these options ...
Copy All Copies all text to the clipboard
Clear Clears the web browser window
Reload Reloads the selected HTML file
- Wait for browser
While this is not a feature visible to a user, gbHTMLNavigator handles waiting for the
browser to complete it's tasks before issuing new commands. The use of Jose Roca's AfxPumpMessages
procedure is used for this purpose.
Using gbHTMLNavigator
gbHTMLNavigator comes with a default HTML file which was built specifically for
the purpose of demonstrating the types of navigation that can be placed under the
control of a PowerBASIC application.
gbHTMLNavigator can open any HTML file, but not all files are written to support the
features it was written to demonstrate.
The goal of gbHTMLNavigator was that programmers would use its capabilities
in their own application, rather than use gbHTML as a stand-alone application.
Toolbar
Most gbHTMLNavigator features or settings are accessed through the toolbar buttons.
- Open
Opens the file selection dialog, to select a *.htm file for display in the browser
- Match
Highlights only terms which match the case of the highlight terms
- Word
Requires highlighted terms to be a word, not partial words
- Exact
Treats the highlight terms as a single string
- Search
Opens the Search dialog
- Previous
Scroll to the previous chapter, from the current selection, and highlight the chapter name
- Next
Scroll to the next chapter, from the current selection, and highlight the chapter name
- Previous
Scroll to the previous section, from the current selection, and highlight the chapter name
- Next
Scroll to the next section, from the current selection, and highlight the chapter name
- Top
Scroll to the top of the browser window
- Bottom
Scroll to the bottom of the browser window
- Settings
- Help
Opens the online Help page.
Toolbar Dropdown Menus
The settings toolbar button provides a dropdown context menu.
Settings
Pressing the Settings button will toggle display of the default web browser context menu
and a custom context menu supplied by gbHTMLNavigator.
Pressing the down arrow next to the Settings toolbar button will display a context menu with
the following options.
- Custom Menu
Toggles the web browser context menu between a custom menu, created by gbHTMLNavigator, and
the default context menu for the web browser.
Keyboard Shortcuts
The following key combinations are available to the user to access gbThreads features:
- F1 - Help
- Ctrl-E - Erase (clear) web browser
- Ctrl-R - Reload HTML file
- Ctrl-F - Open Find dialog
- Ctrl-G - GoTo Chapter #
- Ctrl-U - UnHighlight Entire Document
Other Comments
Misecellaneous information is provided in this section.
Sessions
When gbHTMLNavigator starts, it restores the previous session content.
INI File
gbHTMLNavigator application settings are saved in an INI file, kept in the same folder as the gbHTMLNavigator application.
Comments and suggestions are welcome!
|