TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Herbert Bushong
from: Jonathan de Boyne Pollard
date: 1996-11-28 20:32:12
subject: Help for Help for OWL/2

The following is a precis of how to implement help in a PM application.
  More detail can be found in the IPF Reference that is supplied with your
  C++ compiler.

  Step 1 :  Create a help file.  Make a note of the panel IDs that you
            use.  If you have IPFC version 3, you can use the .nameit
            directive for symbolic panel IDs. Borland C++ only has IPFC
            version 2, which does not have this feature.

  Step 2 :  Create the HELPTABLE and HELPSUBTABLE resources for your
            application.  The help manager uses the help table and help
            subtable resources to look up what panel ID to display when
            the user presses [F1].

            It first uses the window ID of the parent of the window that
            has the focus, or of the window which received the WM_HELP
            message from one of its buttons or menu items, to look up in
            the help table which sub-table to use.  It then uses the
            window ID of the currently focussed window, or the ID of the
            button or menu item, to look up in the given subtable which
            help panel ID to display.

  Step 3 :  Add code to your application to create an instance of the help
            manager, and associate it with your main window.

            Call WinCreateHelpInstance to create the help manager
            instance, and call WinAssociateHelpInstance to associate it
            with your main window.  When you application is exiting, call
            WinDestroyHelpInstance to destroy the help manager instance.

            The module ID and resource ID that you pass to
            WinCreateHelpInstance specify the HELPTABLE resource that you
            created in step 2.  The "library name" that you pass specifies
            the .HLP file that you created in step 1.

  Step 4 :  Add a help menu to your application, and send appropriate
            messages to the help manager instance whenever you receive
            WM_COMMANDs from your help menu.

            In response to the "Help Contents" menu selection, send the
            HM_HELP_CONTENTS message to your help manager instance.  In
            response to the "Using Help" menu selection send the
            HM_DISPLAY_HELP message with a panel ID of 0.

  That's it.  Unlike Windows, where you have to handle the [F1] key
  manually, and call WinHelp explicitly, everything happens automatically
  with Presentation Manager.

  The help manager instance will be automatically informed whenever the
  user attempts to obtain on-line help (for the curious, it registers a
  help hook).  If the window that the user is attempting to obtain on-line
  help for is associated with that help manager instance, the help manager
  will look up the help panel ID in the help tables, read it from the help
  file, and display it.

  For the especially slick, note that you don't even have to have code to
  implement the "Help Index" or "Keys Help" menu items on your
  application's "Help" menu.  This is because under Presentation Manager
  menu items can generate WM_SYSCOMMAND messages as well as WM_COMMAND
  messages, and there are two WM_SYSCOMMAND IDs that will cause a frame to
  automatically invoke the help index and keys help panels.

  The resource definition for your application's help sub-menu should be
  as follows :

    SUBMENU "~Help", IDM_HELP_MENU
    {
        MENUITEM    "Help ~index",      SC_HELPINDEX,       MIS_SYSCOMMAND
        MENUITEM    "Help ~contents",   IDM_HELPCONTENTS
        MENUITEM    "~Using help",      IDM_USINGHELP
        MENUITEM    "~Extended help",   SC_HELPEXTENDED,    MIS_SYSCOMMAND
        MENUITEM    "~Keys help",       SC_HELPKEYS,        MIS_SYSCOMMAND
        MENUITEM    SEPARATOR
        MENUITEM    "~Product Information...",      IDM_ABOUT
    }

  Substitute your own IDM_xxxx IDs, of course.

  > JdeBP <
___
 X MegaMail 2.10 #0:
--- Maximus/2 3.01
* Origin: DoNoR/2,Woking UK (44-1483-725167) (2:440/4)
SEEN-BY: 50/99 270/101 620/243 625/160 711/401 409 410 413 430 808 809 934
SEEN-BY: 711/955 712/407 515 624 628 713/317 800/1
@PATH: 440/4 141/209 270/101 712/515 711/808 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.