Class XbpHelpLabel() Foundation

Class function of the XbpHelpLabel class.

Description

The XbpHelpLabel class provides objects that are used to construct context sensitive help. XbpHelpLabel objects contain all the information required to display a specific help window within the online help. Each Xbase Part that is derived from XbpWindow() includes the :helpLinkinstance variable. This instance variable is used to reference an XbpHelpLabel object containing specific information about the Xbase Part.

The online help itself is managed by objects of the XbpHelp class. An XbpHelp object must be assigned to each XbpHelpLabel object in its :helpObject instance variable. This allows the help windows in the online help to be correctly displayed. In some cases it is sufficient for an XbpHelpLabel object (along with the XbpHelp object it references) to be assigned to the application window. The online help is then activated when the F1 key is pressed by the user. In this case, no context sensitive help is available. To provide context sensitive help, an XbpHelpLabel object must be assigned to each Xbase Part that has corresponding help text in the online help.

Class methods
:new()
Creates an instance of the XbpHelpLabel class.
Instance variables
:helpID
The numeric or symbolic ID for referencing the help text in the online help source code.
:helpObject
Determines the XbpHelp object that manages the online help display.
Life cycle
:create()
Requests system resources for the XbpHelpLabel object.
:configure()
Reconfigures the XbpHelpLabel object after :create() has been executed.
:destroy()
Releases the system resources of the XbpHelpLabel object.
Methods
:showHelpLink()
Displays the help window defined by the XbpHelpLabel object.
Examples
Create context sensitive OS/2 online help

// This example contains the source code for two files: 
// HELPLBL.PRG (Xbase++ source code) and HELPLBL.IPF (IPF 
// source code). The IPF source code is required to run the 
// example. It must be compiled into an HLP file using IPFC.EXE. 
// In the Xbase++ code, integrating the online help is demonstrated. 
// The XbpCrt window is assigned an XbpHelpLabel object and 
// an XbpHelp object is assigned to it. The XbpHelp object 
// manages the online help and generally needs to exist only 
// once in an application. For this reason the XbpHelp object 
// is created in the HelpObject() UDF where it is stored as a 
// STATIC variable. 

* File: HELPLBL.PRG 

#include "Appevent.ch" 

PROCEDURE Main 
   LOCAL nEvent, mp1, mp2, oXbp 
   LOCAL oHlp, oMle 

   SetColor("N/W") 
   CLS 

   // Alt+F4 closes the window 
   SetAppWindow():useShortCuts := .T. 

   // Define Helplink for the window 
   oHlp := XbpHelpLabel():new():create() 
   SetAppWindow():helpLink := oHlp 

   // Create XbpHelp object and assign to XbpHelpLabel 
   oHlp:helpObject := ; 
        HelpObject( "HELPLBL.HLP", "Example for XbpHelpLabel" ) 

   // Create  MLE 
   oMle := XbpMLE():new( ,, {50,60}, {550,300} ) 
   oMle:wordWrap := .F. 
   oMle:create() 

   // Create first pushbutton 
   oXbp := XbpPushButton():new( ,, {50,10}, {140,30} ) 
   oXbp:caption  := "Xbase++ Code" 
   oXbp:activate := {|| oMle:setData( MemoRead("HELPLBL.PRG") ) } 
   oXbp:create() 

   // HelpLink for pushbuttons 
   // IPF Tag -> :h1 id=PUSHBUTTON_HELP.Pushbutton 
   oHlp := XbpHelpLabel():new():create( "PUSHBUTTON_HELP" ) 
   oHlp:helpObject := HelpObject() 
   oXbp:helpLink   := oHlp 

   // Create second pushbutton 
   oXbp := XbpPushButton():new( ,, {200,10}, {140,30}) 
   oXbp:caption  := "IPF Code" 
   oXbp:activate := {|| oMle:setData( MemoRead("HELPLBL.IPF") ) } 
   oXbp:create() 
   oXbp:helpLink := oHlp 
  
   // Event loop 
   nEvent := 0 
   DO WHILE nEvent <> xbeP_Close 
      nEvent := AppEvent( @mp1, @mp2, @oXbp ) 
      oXbp:handleEvent( nEvent, mp1, mp2 ) 
   ENDDO 
RETURN 

// This function generates an XbpHelp object which 
// manages and displays the online help 
// 
FUNCTION HelpObject( cHelpFile, cTitle ) 
   STATIC soHelp 

   IF soHelp == NIL 
      soHelp := XbpHelp():new() 
      soHelp:create( SetAppWindow(), cHelpFile, cTitle ) 
   ENDIF 
RETURN soHelp 

/* 
.***************************************************************** 
.* File: HELPLBL.IPF 
* Must be compiled using >IPFC HELPLBL< to HELPLBL.HLP 

:userdoc. 
:docprof toc=123. 

:h1 id=APP_HELP.General help 
:p.Help for the application window or general help 
for dialog elements that are found in the application window. 

:h1 id=PUSHBUTTON_HELP.Pushbutton 
:p.Click the left mouse button on the pushbutton to cause an action. 

:h1 id=MLE_HELP.Multi Line Edit 
:p.An MLE is used to display and edit text. 

:euserdoc. 
*/ 

Create context sensitive Windows online help

// This example contains the source code for a complete 
// help project. The HTML source code is required to run the 
// example. The project file HELPLBL.HHP must be compiled 
// into a CHM file using HHW.EXE. In the Xbase++ code, 
// integrating the online help is demonstrated. 
// The XbpCrt window is assigned an XbpHelpLabel object and 
// an XbpHelp object is assigned to it. The XbpHelp object 
// manages the online help and generally needs to exist only 
// once in an application. For this reason the XbpHelp object 
// is created in the HelpObject() UDF where it is stored as a 
// STATIC variable. 

* File: HELPLBL.PRG 

#include "Appevent.ch" 

PROCEDURE Main 
   LOCAL nEvent, mp1, mp2, oXbp 
   LOCAL oHlp, oMle 

   SetColor("N/W") 
   CLS 

   // Alt+F4 closes the window 
   SetAppWindow():useShortCuts := .T. 

   // Define Helplink for the window 
   oHlp := XbpHelpLabel():new():create() 
   SetAppWindow():helpLink := oHlp 

   // Create XbpHelp object and assign to XbpHelpLabel 
   oHlp:helpObject := ; 
        HelpObject( "HELPLBL.CHM", "Example for XbpHelpLabel" ) 

   // Create  MLE 
   oMle := XbpMLE():new( ,, {50,60}, {550,300} ) 
   oMle:wordWrap := .F. 
   oMle:create() 

   // Create first pushbutton 
   oXbp := XbpPushButton():new( ,, {50,10}, {140,30} ) 
   oXbp:caption  := "Xbase++ Code" 
   oXbp:activate := {|| oMle:setData( MemoRead("HELPLBL.PRG") ) } 
   oXbp:create() 

   // HelpLink for pushbuttons 
   oHlp := XbpHelpLabel():new():create( "HELPLBL2.HTM" ) 
   oHlp:helpObject := HelpObject() 
   oXbp:helpLink   := oHlp 

   // Create second pushbutton 
   oXbp := XbpPushButton():new( ,, {200,10}, {140,30}) 
   oXbp:caption  := "HTML Code" 
   oXbp:activate := {|| oMle:setData( MemoRead("HELPLBL2.HTM") ) } 
   oXbp:create() 
   oXbp:helpLink := oHlp 
  
   // Event loop 
   nEvent := 0 
   DO WHILE nEvent <> xbeP_Close 
      nEvent := AppEvent( @mp1, @mp2, @oXbp ) 
      oXbp:handleEvent( nEvent, mp1, mp2 ) 
   ENDDO 
RETURN 

// This function generates an XbpHelp object which 
// manages and displays the online help 
// 
FUNCTION HelpObject( cHelpFile, cTitle ) 
   STATIC soHelp 

   IF soHelp == NIL 
      soHelp := XbpHelp():new() 
      soHelp:create( SetAppWindow(), cHelpFile, cTitle ) 
   ENDIF 
RETURN soHelp 



/* HELPLBL.HHP = Help project file 

[OPTIONS] 
Compiled file=helplbl.chm 
Contents file=helplbl.hhc 

[FILES] 
helplbl1.htm 
helplbl2.htm 
helplbl3.htm 

*/ 

/* HELPLBL.HHC = Tabe of contents 

<HTML> 
<HEAD> 
<BODY> 
<UL> 
   <LI> <OBJECT type="text/sitemap"> 
        <param name="Name" value="General Help"> 
        <param name="Local" value="helplbl1.htm"> 
        </OBJECT> 
   <LI> <OBJECT type="text/sitemap"> 
        <param name="Name" value="Pushbutton"> 
        <param name="Local" value="helplbl2.htm"> 
        </OBJECT> 
   <LI> <OBJECT type="text/sitemap"> 
        <param name="Name" value="Multi Line Edit"> 
        <param name="Local" value="helplbl3.htm"> 
        </OBJECT> 
</UL> 
</BODY></HTML> 

*/ 

/* HELPLBL1.HTM = First help window 

<HTML> 
<HEAD> 
<title>General Help</title> 
</HEAD> 
<BODY> 
<p> 
Help for the application window or general help 
for dialog elements that are found in the application window. 
</p> 
</BODY></HTML> 

*/ 

/* HELPLBL2.HTM = Second help window 

<HTML> 
<HEAD> 
<title>Pushbutton</title> 
</HEAD> 
<BODY> 
<p> 
Click the left mouse button on the pushbutton to cause an action. 
</p> 
</BODY></HTML> 

*/ 

/* HELPLBL3.HTM = Third help window 

<HTML> 
<HEAD> 
<title>Multi Line Edit</title> 
</HEAD> 
<BODY> 
<p> 
An MLE is used to display and edit text. 
</p> 
</BODY></HTML> 

*/ 
Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.