home *** CD-ROM | disk | FTP | other *** search
- Help module for C desktop applications version 2.02
- by Ben Summers
-
- Overview
- ~~~~~~~~
- I have written this module to provide a feature that Acorn forgot to include
- in the RISCOS library - an easy to use interface to the interactive help
- application.
-
- This help module uses the application resource 'HelpText' to find the text
- of the help. This show the messages to be returned for the window, and icons
- in it. The format of this file is described below.
-
- The functions provided do not return errors when they fail. This is because
- the help system is a non-essential part of the program, and I don't really
- think it is worth taking any special action when it fails. However, if help
- has not been initialised or help is requested for a window which is not
- defined in the HelpText, it will terminate your application with an error
- message. These are the only times it will do this.
-
- To use the module, just link it into your program. You may use it in any
- application you write, PD or commercial. Please send me a copy of any
- application you write with it.
-
- The module provides three functions, which are documented below.
-
- void help_init(BOOL load);
- ~~~~~~~~~~~~~~~~~~~~~~~~~~
- This function initialiases the help system. It must be called before any
- other help functions are called. You must have initialised the wimp modules
- of the RISCOS Lib, res and flex before you call this. If load == TRUE, the
- helptext is loaded. If load == FALSE, the helptext will be loaded when it is
- needed. I would recommend setting load to FALSE so the helptext will not
- waste memory.
-
- void help_send(const char *win_name);
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- This function sends help to the interactive help application when it asks
- your application for some help. win_name is the name of the window you want
- to send help about.
-
- You should add this function to your event handler for a window with a bit
- of code like this:
-
- switch (e->e)
- {
- /* other event types... */
-
- case wimp_ESEND:
- case wimp_ESENDWANTACK:
- if(e->data.msg.hdr.action == wimp_MHELPREQUEST)
- help_send("window");
- break;
- }
-
- "window" is the name of a window defined in the HelpText resource. See below
- for the format of it.
-
- void help_send_text(const char *text);
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- This function sends text to the interactive help application. The text must
- be no longer than help_MAX_HELP_TEXT characters long including the
- terminating \0.
-
- This function is provided so you can send your own help messages when there
- are no icons in the window, and the message changes. For example, you might
- want to use this for X,Y coordinates.
-
- This function should only be called after a request for help has been
- received by your application.
-
- BOOL help_dbox_help(dbox d, void *event, void *handle);
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- This function allows you to use interactive help on dialogue boxes. To use
- it, you must register it with the dbox module with the following function
- call:
-
- dbox_raw_eventhandler(d, help_dbox_help, "window");
-
- d = dbox handle
- "window" = name of window in help text
-
- The HelpText resource
- ~~~~~~~~~~~~~~~~~~~~~
- The HelpText application resource gives the messages to be used. It is a
- list of windows with their messages.
-
- Each window has a basic message (like 'This window displays your sprite.'),
- and messages for the icons in the window. The basic message will always be
- sent, followed by an text for an icon.
-
- To define a window, you use a line like
-
- @win_name:Basic message
-
- The lines after this are the messages for the icons. Each line is an icon,
- numbered from 0 upwards. There doesn't have to be text for every icon. If
- you want to include a line break, put '|M' in the text.
-
- There are three special windows, VERSION, DICT and END which must be
- included. The basic message for VERSION is the current version number of the
- help module * 100. In this version, the value you should use is 200.
-
- The DICT window is a dictionary of phrases you oftern use in the text - for
- example 'This sets the drive to '. There is no basic message for this
- window.
-
- To define a dictionary entry, you put an icon in the DICT window which reads
-
- item_name:Text for this entry
-
- To use this entry in the text of a icon, you insert into the text
- '%item_name%' where you want the text to be placed.
-
- The HelpText file should be ended by defining the window 'END'.
-
- An example HelpText file is included. It is a bit of the HelpText file from
- my program FileUtils.
-
- The author
- ~~~~~~~~~~
- This help module was written by Ben Summers. If you have any comments, wish
- to report a bug or want to send a token of your apprecation (discs of PD,
- applications you write using this etc) please write me at the address below.
- Please send an SAE if you want a reply.
-
- Ben Summers
- 1 St Clements Hill
- Norwich
- NR3 4DE
-
- Legal note
- ~~~~~~~~~~
- This module is public domain. The copyright of the module remains with me.
- When you distribute it as a module, you must include this text file and the
- example HelpText file, but you do not need to include it when the module is
- linked into your application.
-