Class wwHelp

The wwHelp object is exposed as an Automation interface that provides access to the help project and generation engine. With the COM object you can automate all aspects of interaction with the help project which includes:

  • Opening and closing the project
  • Loading and Saving of topics
  • Modifying topics
  • Rendering HTML from a topic
  • Assigning an HTML template to the topic to render

The interface provides much more functionality, but these are the highlights. See the detailed methods for additional information on the functionality available.

ProgId: wwHelp.wwHelp

Class Members

MemberDescription

addConfig

Adds a Configuration Record to the table. Pass the project title optionally. You can also pass INDEX and it will create an Index Topic

addConfig() as Variant

addspecialrecord

Adds a special record type. Specify a type of record to add: CONFIG or INDEX are currently used.

addspecialrecord(lcType as Variant,lcProjTitle as Variant,lcCompany as Variant,lcLanguage as Variant,lcIconFile as Variant) as Variant

Close

Closes the currently open help project.

wwHelp::Close()

compileproject

Runs the Help Compiler to build the final CHM HTML Help file.

compileproject(llSilent as Variant,lcWorkshopPath as Variant) as Variant

copytopic

Copies an existing topic and assigns new Ids

copytopic(lcParentPk as Variant) as Variant

createobject

Allows creation of a new object in the project and passing back a reference to the client.

createobject(lcClass as Variant) as Variant

deletetopic

Deletes the currently active topic from the project file.

o.deletetopic(llDeleteTree)

displaybranch

Runs through a hierarchical branch recursively. Calls OnDisplayBranchTopic which can be used to hook display logic.

displaybranch(lcParent as Variant,lcAction as Variant,llTop as Variant,lcAction2 as Variant) as Variant

Error

Occurs when there is a run-time error in a method.

Error(nError as Long,cMethod as String,nLine as Long) as Variant

formathtml

HTML formatting routine that is used for formatted HTML display. Handles line breaks, HTML tag display and HTML tag markup using the tag Help Builder's markup.

formathtml(lcHTML as Variant,llUnformat as Variant,llDontParseTopicLinks as Variant) as Variant

generatehtml

Generates HTML files for all topics in the project. Files are sent to the same path as the project.

generatehtml() as Variant

generateindex

Generates the index and project files for the HTML Help project.

generateindex() as Variant

generatetoc

Generates the Table of Contents file for the Help project.

generatetoc(lnLimitSize as Variant,llAddDates as Variant,llSilent as Variant,lcIconFile as Variant,llAllowServerSearch as Variant) as Variant

generatetocex

Generates only the TOC portion of the TOC for display.

generatetocex(lnLimitSize as Variant,llAddDates as Variant,llSilent as Variant,lcIconFile as Variant) as Variant

GetData

Retrieves a Help oData object without affecting the current topic. Pass BLANK as the Pk to create an return object. Useful to allow copying data or saving data.

GetData(lcPK as Variant) as Variant

gethreflink

Returns a full HREF link based on the current setting of View mode. This determines whether a WCS script link is inserted or a link to a filename. Return value based on the lViewerMode flag.

gethreflink(lcTopic as Variant,lcPK as Variant,lcExtraTags as Variant,lcAnchor as Variant) as Variant

getimageidfromtopictype

Returns an Image ID for a topic type from the local lookups table

getimageidfromtopictype(lcType as Variant) as Variant

GetProperty

Retrieves a property stored with SetProperty in the Properties field of the help object. Properties are returned in typed format depending on their original input value.

o.GetProperty(lcProperty, @laProperties)

gettopicfilename

Creates a legal file name from a topic by stripping out spaces and illegal characters.

gettopicfilename(lcPK as Variant) as Variant

GetTopics

This method allows you to retrieve topics as an array. You may optionally specify a filter string which is used as part of a SQL WHERE clause.

o.GetTopics(lcCursor, lcQuery)

GOCONFIG

Goes to the Configuration Record. Creates it if it doesn't exist.

GOCONFIG() as Variant

insertinheritancetree

insertinheritancetree(lcInheritanceField as Variant) as Variant

insertseealsotopics

Inserts HTML for all the related topics. Topics are returned as a string of HREF links. This is used directly on the template form and wrapped with formatting tags.

insertseealsotopics() as Variant

istopic

Quickly checks to see if a topic exists based on a PK.

istopic(lcPK as Variant) as Variant

LoadTopic

This method is used to retrieve a specific topic. The topic is searched for by either Pk or Topic field depending on the lTopic parameter. If .T. search is performed by topic otherwise it's assumed the PK is used.

oHelp.LoadTopic(cPk,lTopic)

newtable

Creates a brand new help table and project directory structure. Automatically creates configuration and index records as well as the full directory structure including templates and images directories in the subtree.

o.CreateProject(lcFileName,lcTitle)

newtopic

Creates a new empty topic in the oTopic member of the object. NewTopic creates a ready to use topic with a PK and created timestamp set. Simply set properties and call SaveTopic.

o.newtopic()

ondisplaybranchtopic

Gets called for each topic that is accessed by Display Branch. Uses the current alias - make sure to reset it before returning.

ondisplaybranchtopic() as Variant

Open

Opens a help project file. If the file does not exist this function prompts for a file unless the llSilent parameter is passed as true.

wwHelp::Open(cFileName,llForceReopen,llSilent)

OpenForm

This powerful method brings up the Help Builder User Interface. By passing in a search key you can automatically pre-select a specific topic to display to the user. The lookup can be based on the PK, a Topic or the Help ContextId.

o.OpenForm(cLookup,nType,cFilename)

Preview

Shows a topic in the default browser or optionally in a Web Browser control passed.

o.Preview(oWebBrowser)

printtopic

Prints the current topic to the printer. A dialog is displayed prior to printing. Optionally pass an HTML string to print.

o.printtopic(lcHTML)

reindex

Creates the indexes and packs the help project file.

o.reindex()

RenderTopic

Renders the currently active topic using the current cHTMLTemplate (see wwHelp::SetTemplate). The topic is rendered into a string which typically will be HTML, but maybe a macro string to feed to Word or like Word processor.

wwHelp::RenderTopic(lcTopicPK)

RunWizard

o.RunWizard(cWizard)

savetableas

Saves the current help table to a new file.

o.savetableas(lcFileName)

savetopic

Saves the currently selected help topic to disk. The data written comes from the wwHelp.oTopic member.

o.savetopic(llCompare)

SetError

Sets the error settings

SetError(lcMessage as Variant) as Variant

setexpanded

Sets the expanded property of the currently selected topic. Writes the change to the table

setexpanded(llExpanded as Variant) as Variant

setoutputpath

setoutputpath(lcTargetPath as Variant) as Variant

SetProperty

Sets a property in the Properties field of the Help object. This method allows storage of custom values in a help topic that can be retrieved with GetProperty.

o.SetProperty(lcProperty, lvValue,lcType,lcDescription)

SetTemplate

This method allows you to specify a template for use by the next call to RenderTopic. You can specify a template either by:

wwHelp::SetTemplate(cTemplate)

settemplatescheme

Changes the Template Scheme to a new scheme. Returns .T. or .F. on success/failure.

settemplatescheme(lcSheme as String,llSilent as Boolean) as Variant

StatusMessage

Routine used to display status messages. By default this method implements WAIT WINDOWS. This method can be overridden to redirect output to an alternate location.

StatusMessage(lcMessage as Variant,lnPercent as Variant) as Variant

TocBranch

Walks a branch of topics recursively for Table of Contents generation.

TocBranch(lcParent as Variant,loHTML as Variant,llPlainHTML as Variant,llAddDate as Variant) as Variant

tocbranchex

Generates a pure HTML viewable TOC branch

tocbranchex(lcParent as Variant,loHTML as Variant,lnLevel as Variant,llPlainHTML as Variant,llAddDate as Variant) as Variant

updatelinks

Allows changing all crossreference links from one string to another.

updatelinks(lcOldLink as Variant,lcNewLink as Variant) as Variant

updatepk

updatepk(lcOldPk as Variant,lcNewPK as Variant) as Variant

updateprojectfile

Updates the current project file to the latest version

updateprojectfile() as Variant

writedata

Writes a Data object to the current help data object

writedata(loTopic as Variant) as Variant

CALIAS

Internal alias of the Help file.

CAPPNAME

Name of the Help application. Displays in the tile before topic name

cappstartpath

Location where Help Builder was started from. This value is crucial when running the wwHelp COM object.

cerrormsg

Error Message if lError = .T.

cFileName

Contains the full path to the currently open help project file.

cftppath

The FTP Path to use to upload the project

chelpcollection

Name of the Help 2.0 collection that gets generated. Defaults to the filename stripped of spaces and special chars.

chelpnamespace

The Help Namespace used for an Help20 collection.

chidetopiclist

List of PKs of topic trees that are not to be included when the final help file is built.

cltag

Left formatted HTML tag. Defaults to <<.

COUTPUTPATH

cprojcompany

cprojecticonfile

The icon strip BMP file for this project. Optional and blank uses the internal default file of the help engine.

cprojectlanguage

The Language ID of the project used. This is a string value that is in the format of: 0x409 English (United States)

cprojectname

cprojpath

Path of the project

crtag

Right formatted text HTML tag. Defaults to >.

ctitle

Title of the help project

lautoinchelpid

Set to .T. to automatically increment the Help Context ID for each new topic.

lerror

Error Flag - .T. when an error occurred during the last operation

lnewtopic

Flag to tell whether the current topic is a new topic. Used by SaveTopic() to determine whether to add a new record.

lprintmode

Determines whether we're generating a document for printing. When we do we generate links as # and add an anchor to the top of the topic.

lviewermode

The mode that the class is displayed in. .T. displayed inside the viewer with VFPS:// links. .F. normal mode with relative links.

Name

Specifies the name used to reference an object in code.

nhtmlformat

0 - Formatted (<> tags to {}/linebreak formatting) 1 - Raw HTML

ocodeparser

Code Parser that is used to turn code into syntax colored highlighted HTML

odom

Reference to XMLDOM object

oform

Reference to an open wwHelp form instance.

oTopic

The oTopic member is the key member that allows access to all of the topic data fields. All of the oTopic members map directly to the data fields of the project file. See Topic data field layout for more details.

owwhelpevents

Help Builder Event Object reference which allows firing events in an external COM object to allow extension of the class.

Example

*** FoxPro code sample using COM
oHelp=CREATEOBJECT("wwHelp.wwHelp")

*** Open the help project - Force to reopen
oHelp.Open("d:\installs\wwhelp\sample\webmonitor.hbp",.T.)
oHelp.LoadTopic("Class wwIPStuff",.T.)

*** Assign a template to use for rendering
oHelp.SetTemplate()

*** Return an HTML string of the topic
lcHTML =  oHelp.RenderTopic()

*** Display topic in browser
oHelp.Preview()

*** Display topic in a Web Browser Control
oHelp.Preview(loWebBrowserCtl)

*** Properties
lcProjFile = oHelp.cFileName

*** oData Member contains topic data
lcTopic = oHelp.oTopic.Topic
lcBody = oHelp.oTopic.Body
lcPK = oHelp.oTopic.PK

oHelp.SaveTopic()

oHelp.NewTopic()
loTopic = oHelp.oTopic

loTopic.Title = "New Topic"
loTopic.Body = "New topic body"

oHelp.SaveTopic()

© West Wind Techologies, 2018 • Updated: 03/29/18
Comment or report problem with topic