TweetFollow Us on Twitter

Help Function
Volume Number:3
Issue Number:4
Column Tag:C Workshop

List Manager Inspires Help Function Solution

By William Rausch, Battele Pacific Northwest Labs, Richland, WA

I’ve always liked the method of presenting “on-line help” information used by the Excel™ program. When I received the LightSpeed C™ V2.01 upgrade for the 128K ROMS, I created a similar kind of help function while learning how to use some of the List Manager routines. This article presents my “help” function, and explains how to implement it in C, using the List Manager.

The help dialog box is shown in Figure 1. It contains an OK button and two boxes, one for the list of topics and one to show the help information for the currently selected topic. The help function builds the list of topics dynamically, using an STR# resource number passed to it by the calling routine. Each string in the STR# resouce contains a topic and a reference number. The reference number is the ID of a HELP resource. Whenever the user selects a topic, the ASCII text from the corresponding HELP resource is displayed in a scrollable TextEdit record.

The code shown in Listing 1 consists of a very simple main() and an equally simple do_about() function, and the routines that make up the help function: do_help(), read_help(), show_help(), help_filter(), and help_action().

do_help() is called to start things off. It takes a single parameter, the ID of the STR# resource that contains the help topics to be displayed. By using a parameter in this way, it should be easy to introduce some context sensitivity into the help that gets displayed. do_help() reads in the STR# resource and gets the number of topics in the list. It reads the dialog resource for the help dialog window. The help_list user item is then read in to get its dimensions. This information (dimensions and number of topics) is used to create the empty list structure with a call to the List Manager routine LNew(). Note that the List Manager requires that the dimensions include room for the scroll bar (if one is present).

The read_help() function gets the individual strings from the STR# resource and parses each one for a topic and an ID number. A backslash is used as the delimeter marking the end of the topic and the start of the ID number. As each topic is read in, it is added to the topic list by calling the List Manager routine LSetCell(). Its corresponding HELP ID number is stored in the array help_id[]. Finally, the List Manager routine LSetSelect() is called to select the first cell as the starting point and LDoDraw() is called to make the list visible.

The show_help() function sets up the help text box by getting its dimensions from the second user item in the dialog resource. (As with the topic list box, the user item is large enough to include the scroll bar as well.) The font and size are then specified. After some experimenting, I settled on 10-pt Geneva font. There is no reason you couldn’t select some other font for your application though.

Once the help box is prepared, we load it with the HELP resource that corresponds to the first topic in the list (since that topic is selected when the help dialog first appears on the screen). This is done by merely reading in the HELP resource designated by help_id[0]. A HELP resource is merely composed of ASCII text, and it is copied directly into the TextEdit record using the TEInsert() routine. Finally, the need for a vertical scroll bar is checked, and if it is, then it is activated and the proper maximum value is set using SetCtlMax(). Then, we repeatedly call ModalDialog() until the user clicks OK (or hits Return). At that time we dispose of the various data structures and return.

Fig. 1 Our help function demo in action!

The interaction with the user is controlled by the help_filter() function passed to ModalDialog() as a filterProc. (Note that help_filter() is declared as ’Boolean Pascal‘. This is because it will be called by the ROM routines and needs to conform to the expected way of passing parameters.) Since it gets to examine every single event that occurs while the modal dialog is running, it is very easy to respond to user actions. Basically, the routine is nothing but a switch statement on the type of event. On an updateEvt it redraws the user items (our two boxes). On a keyDown it checks to see if it was a Return and, if so, tells the calling routine that the OK button was selected. On a mouseDown, it may perform a number of activities as we will see. For any other event, it does nothing.

To handle a mouseDown event, the function first checks to see if the mouse was clicked in a scroll bar. If it was clicked in our help box scroll bar, TrackControl() is called. TrackControl() is called with or without an actionProc depending on whether the mouseDown occured in the “thumb” or elsewhere in the scroll bar. If the mouseDown occured in the thumb, the help text is scrolled after the call to TrackControl() returns. If the mouseDown occured in some other part of the scroll bar (up or down arrow, up or down page), the function help_action() is passed as an actionProc. (As with the filterProc previously discussed, it is declared as a ‘Pascal’ function, but of type void since it doesn’t return a value of any type.) help_action() merely checks the partcode it is passed, gets the current value of the scroll bar, and scrolls the text up or down as neccessary to accomodate the user’s actions. The up and down arrows cause the text to scroll one line at a time; the up and down pages cause the text to scroll five lines at a time.

Fig. 2 STR# Resources for topic headlines

If the click occurred in the List Manager’s scroll bar, call the routine LClick() to handle it. If the click was not in a scroll bar, check to see if it was inside the topic box. (A Rect is the first item of the List Manager’s data structure; hence the “*h.help_list” used for the PtInRect() call.) If so, call the LClick() routine and see if the user has selected a new topic. Do this by comparing the cell number returned from a call to LGetSelect() with the one saved in h.last_one. If the selected topic has changed, delete the help text currently stored in the TErecord and replace it with the HELP resource corresponding to the new topic. Then, update h.last_one with the new cell number.

Any other type of event is ignored by the filterProc and is left to the ModalDialog() function to handle. When the user finally clicks the OK button (or hits Return), the while() loop surrrounding the call to ModalDialog() (in show_help()) completes and we clean up after ourselves by disposing of the various data structures we created.

The help dialog resource just contains three items:

1) an OK button

2) a user item for the help text

3) a user item for the topic list

This resource is easy to create using ResEdit. It doesn’t matter what shape or size the user items are or where in the dialog they are located. Just make sure that they include enough space for the scroll bars to fit alongside your text.

The HELP resources are just ASCII text. I created mine using ResEdit 1.1-D. It would be easy to write a simple program that would take text from an editor file and convert it into a HELP resource. No special formatting is necessary (however, be sure to use just normal printing ASCII characters that TextEdit knows how to handle). The topic lists are just as simple. Create an STR# resource, where each string contains the topic, a backslash, and the ID number of a HELP resource (see Figure 2). [To give you the big picture of how this is done, the resource file was "de-compiled" with DeRez and "re-compiled" with Rez. The resource listing at the end of the article is the Rez input file, with the hex data for the help strings removed to save space. Note that the STR# resources in Rez format appear to have an extra backslash, but this is apparently the Rez formatting character as figure 2 clearly shows a single backslash seperating our topic from the ID number of the help resource. -Ed]

To conclude, I think that this on-line help function is an easily implemented, yet powerful, method of presenting information to a user. The major advantage when compared to Excel and other such programs is that it allows you to more easily peruse information about multiple topics. The ability to easily present context sensitive help is another bonus.

Fig. 3 LS C Link Window

Listing 1: C source code for the help demo program
/************************************************
 * help.c - demo program shows a new way to
 *          present on-line help
 *
 * Bill Rausch, Jan 1987
 * Uses LightSpeed C™ (Think Technologies, Inc.)
 ***********************************************/

#include <EventMgr.h>
#include <MenuMgr.h>
#include <WindowMgr.h>
#include <ToolboxUtil.h>
#include <DialogMgr.h>
#include <FontMgr.h>
#include <TextEdit.h>
#include <ListMgr.h>
#include <strings.h>
#include <pascal.h>

#define NULL 0L
#define ACTIVATE 0
#define INACTIVATE 255

#define FILEID 256
#define ABOUT 1 
#define HELP 2
#define QUIT 3

#define HELP_DLG 256
#define HELP_OK 1
#define HELP_BOX 2
#define HELP_LIST 3

#define HELP_STR 256 /* STR# containing topics */
#define MAX_HELPS 100 /* application dependent */

struct {
  Rect text_box;    /* user item dimensions */
  Rect topic_box;   /* user item dimensions */
  TEHandle text;
  ListHandle topics;
  Rect d_rect;      /* TextEdit's dest rect */
  Rect v_rect;      /* TextEdit's view rect */
  int offset;       /* d_rect vertical shift */
  int lines_vis;    /* number of lines visible */
  ControlHandle text_scroll;
  int max_text;     /* max value of scroller */
  int help_id[MAX_HELPS]; /* topics’ HELP IDs */
  int num_topics;   /* how many topics? */
  int last_one;     /* last cell clicked in */
  } h;

pascal Boolean help_filter();
Boolean show_help();
pascal void help_action();

/************************************************
 * Trivial main(), just enough to use a single 
 * menu with only three items: About..., Help...,
 * and Quit. No DAs, no windows, no command key
 * equivalents or other key strokes. */
main()
  {
  EventRecord the_event;
  WindowPtr which_window;
  int menu_id, item_number;
  long menu_code;
  int window_code;
  MenuHandle filemenu;
  
  FlushEvents(everyEvent, 0);
  InitGraf(&thePort);
  InitFonts();
  InitWindows();
  InitMenus();
  TEInit();
  InitDialogs(NULL);
  
  filemenu = GetMenu(FILEID);
  InsertMenu(filemenu, 0);
  DrawMenuBar();
  InitCursor();
  
  for (;;)  /* event loop */
    {
    if (GetNextEvent(everyEvent, &the_event)) 
      {
      if (the_event.what == mouseDown)
        {
        window_code=FindWindow(the_event.where,&which_window);
        if (window_code == inMenuBar)
          {
          menu_code = MenuSelect(the_event.where);
          menu_id = HiWord(menu_code);
          item_number = LoWord(menu_code);
          if (menu_id == FILEID)
            {
            if (item_number == ABOUT)
              do_about(
          "Help demo - Bill Rausch - Jan. 1987",
          "LightSpeed C™ by Think Technologies");
            else if (item_number == HELP)
              do_help(HELP_STR);
            else if (item_number == QUIT)
              ExitToShell();
            else
              SysBeep(1);
            }
          HiliteMenu(0);
          DrawMenuBar();
          }
        else
          SysBeep(1);
        }
      else
        SysBeep(1);
      }
    }
  }

/***********************************************/
/* creates alert-like box, waits for mouseDown */
do_about(text1, text2)    
char *text1, *text2;
  {
  long dummy;
  Rect box;
  Rect line;
  GrafPtr old_port;
  WindowPtr window;
  EventRecord an_event;
  
  SetRect(&line, 6, 5, 345, 25);
  SetRect(&box, 75, 125, 425, 180);
  window = NewWindow(NULL, &box, "", TRUE,
                     dBoxProc, -1L, TRUE, NULL);
  GetPort(&old_port);
  SetPort(window);
  
  TextFont(systemFont);
  TextBox(text1, (long)strlen(text1), &line,
          teJustCenter);
  OffsetRect(&line, 0, 28);
  TextBox(text2, (long)strlen(text2), &line,
          teJustCenter);
  
  do { 
    GetNextEvent(everyEvent, &an_event);
    } while (an_event.what != mouseDown);
    
  DisposeWindow(window);
  SetPort(old_port);
  }

/************************************************
 * Help routine that makes use of the List 
 * Manager to present user with a list of topics
 * and help text about each one. The topics are
 * stored as a STR# resource and the help texts
 * are stored as HELP resources. Each topic 
 * string contains the number of its associated
 * HELP resource.
 * Note: requires Geneva 10 font to be present */
do_help(str_id)
int str_id;
  {
  DialogPtr the_dialog;
  Handle scr_handle;      /* scratch variable */
  int scratch;            /* scratch variable */
  Str255 scr_str;         /* scratch variable */
  Rect hdata_rect;  /* for list manager setup */
  Point cell_size;  /* for list manager setup */
  Handle topics;    /* for list manager setup */
  int *n_t_ptr;
  GrafPtr old_port;
  
  /* Read STR#, get number topics */
  topics = GetResource('STR#', str_id);
  h.num_topics = *(int *)(*topics);
  
  /* Read dialog box resource */
  the_dialog = GetNewDialog(HELP_DLG, NULL, -1L);
  GetPort(&old_port);    /* save where we were */
  SetPort(the_dialog);
  
  /* get user item for topic list */
  GetDItem(the_dialog, HELP_LIST, &scratch,
           &scr_handle, &h.topic_box);
  InsetRect(&h.topic_box, 1, 1);
  /* leave room for vertical scroll bar */
  h.topic_box.right -= 15;
  SetRect(&hdata_rect, 0, 0, 1, h.num_topics);
  SetPt(&cell_size, h.topic_box.right - 
        h.topic_box.left, 16);
  
  h.topics = LNew(&h.topic_box, &hdata_rect, 
                  cell_size, 0, the_dialog,
                  FALSE, FALSE, FALSE, TRUE);
  (*h.topics)->selFlags = lOnlyOne;
  /* restore rect for framing */
  InsetRect(&h.topic_box, -1, -1);
  read_help(h.topics,h.num_topics,h.help_id,str_id);
                       
  if (!show_help(the_dialog, h.topics, 
                 h.help_id))
    do_about("show_help()",
             "returned an error.");
    
  SetPort(old_port);    /* put us back */
  }

/************************************************
 * Read the topics from the STR# resource. Add
 * them to the List as they are read. Also, save
 * the IDs in an array for use later in finding
 * the proper HELP resource to display for each
 * topic. */
read_help(topics, num_topics, help_id, 
                  str_id)
ListHandle topics;
int num_topics;
int help_id[];
int str_id;
  {
  int i;
  Str255 a_topic;
  Point the_cell;
  char *id_number;
  Str255 strvar;
  
  for (i=0; i<num_topics; i++)
    {
    GetIndString(a_topic, str_id, i+1);
    PtoCstr(a_topic);
    id_number = strchr(a_topic, (char)'\\');
    
    /* terminate topic and point to number */
    *id_number++ = '\0';
    help_id[i] = atoi(id_number);
    
    SetPt(&the_cell, 0, i);
    LSetCell(a_topic, strlen(a_topic), the_cell,
             topics);
    }
               
  SetPt(&the_cell, 0, 0);
  LSetSelect((Boolean)TRUE, the_cell, topics);
  LDoDraw((Boolean)TRUE, topics);
  }

/************************************************
 * Set up the help text for the first topic in 
 * the list. Call ModalDialog (with a filterProc
 * to do all the work). Loop until user clicks
 * OK. */
Boolean show_help(the_dialog, topics, help_id)
DialogPtr the_dialog;
ListHandle topics;
int help_id[];
  {
  GrafPtr old_port;
  int item_hit;     /* returned by ModalDialog */
  int scr_int;       /* scratch variable */
  Handle scr_handle; /* scratch variable */
  Boolean done = FALSE;
  int i, buf_size;
  Rect scroll_rect;
  Handle the_help;
  
  /* get user item for help text */
  GetDItem(the_dialog, HELP_BOX, &scr_int, 
           &scr_handle, &h.text_box);
  /* leave room for scroll bar */
  h.text_box.right -= 16;
  scroll_rect.right = h.text_box.right + 15;
  scroll_rect.left = h.text_box.right - 1;
  scroll_rect.top = h.text_box.top;
  scroll_rect.bottom = h.text_box.bottom;
  h.text_scroll = NewControl(the_dialog, 
                          &scroll_rect, "", TRUE, 
                          0, 0, 0, 16, NULL);
  HiliteControl(h.text_scroll, INACTIVATE);
  
  /* Set up TextEdit record for the help text */
  h.d_rect.top = h.text_box.top + 1; 
  h.d_rect.left = h.text_box.left + 1;
  h.d_rect.right = h.text_box.right - 1;
  h.d_rect.bottom = 20000;    /* infinity */
  h.v_rect = h.text_box;
  InsetRect(&h.v_rect, 1, 1);
  h.text = TENew(&h.d_rect, &h.v_rect);
  (*h.text)->txFont = geneva;
  (*h.text)->txSize = 10;
  
  h.last_one = 0;    /* 1st topic selected */
  h.offset = 0;      /* at top left corner now */
  h.lines_vis = (h.v_rect.bottom - h.v_rect.top) 
                / (*h.text)->lineHeight;
  
  /* put 1st topic’s text into help box */
  the_help = GetResource('HELP', help_id[0]);
  buf_size = SizeResource(the_help);
  TEDeactivate(h.text);
  TESetSelect(32767L, 32767L, h.text);
  HLock(the_help);
  TEInsert(*the_help, (long)buf_size, h.text);
  HUnlock(the_help);
  
  /* vertical scroll bar necessary? */
  if ((*h.text)->nLines > h.lines_vis)
    {
    HiliteControl(h.text_scroll, ACTIVATE);
    h.max_text = (((*h.text)->nLines) - 
            h.lines_vis) * (*h.text)->lineHeight;
    SetCtlMax(h.text_scroll, h.max_text); 
    }

  ShowWindow(the_dialog);
  do {
    ModalDialog(help_filter, &item_hit);
    if (item_hit == HELP_OK)
      done = TRUE;
    } while (!done);
    
  TEDispose(h.text);
  LDispose(h.topics);
  DisposDialog(the_dialog);
  return TRUE;
  }


/************************************************
 * This routine handles activating and updating 
 * of the scroller and the box area. We must 
 * handle mouse downs in the scroller and text 
 * box, passing back TRUE, and pass FALSE back 
 * for everything else so the Dialog Manager does
 * his thing on the other items. */
pascal Boolean help_filter(dp, ep, ip)
WindowPtr dp;
EventRecord *ep;
int *ip;
  {
  int part;
  ControlHandle ch;
  char tempchar;  /* check keydown for RETURN */
  Point mouse_loc;
  int start_value, end_value, dummy, delta;
  long a_cell;
  int cell_num;
  Handle the_help;
  int buf_size;
  int scr_int;       /* scratch variable */
  Handle scr_handle; /* scratch variable */
  Rect scr_rect;     /* scratch variable */
  
  switch(ep->what)
    {
    case updateEvt:
      /* is the update event for this window? */
      if (ep->message == (long)dp)
        {
        /* outline default button */
        GetDItem(dp, HELP_OK, &scr_int, 
                 &scr_handle, &scr_rect);
        InsetRect(&scr_rect, -4, -4);
        PenSize(3, 3);
        FrameRoundRect(&scr_rect, 16, 16);
        PenNormal();
        /* draw boxes around topics, text */
        FrameRect(&h.topic_box);
        FrameRect(&h.text_box);
        /* update contents of boxes */
        EraseRect(&h.v_rect);
        TEUpdate(&h.v_rect, h.text);
        LUpdate(dp->visRgn, h.topics);
        }
      return FALSE;

    case keyDown: 
      /* convert return key to OK button */
      tempchar = BitAnd(ep->message, 
                        charCodeMask);
      if (tempchar == '\r')
        {
        *ip = HELP_OK;
        return TRUE;
        }
      return FALSE;
      
    case mouseDown:
      /* get our own copy of coordinates */
      mouse_loc = ep->where;
      GlobalToLocal(&mouse_loc);
      
      part = FindControl(mouse_loc, dp, &ch); 
      if (part > 0)
        {
        /* is click in a scroll bar? */
        if (ch == h.text_scroll)
          {
          if (part == inThumb)
            {
            if(TrackControl(ch, mouse_loc, NULL))
              {
              /* reposition help text */
              delta = h.offset - 
                      GetCtlValue(h.text_scroll);
              TEScroll(0, delta, h.text);
              h.offset -= delta;
              }
            }
          else
            TrackControl(ch, mouse_loc, 
                         help_action);
          return TRUE;
          }
        else if (ch == (*h.topics)->vScroll)
          {
          LClick(mouse_loc, ep->modifiers, 
                 h.topics);
          return TRUE;
          }
        else
          return FALSE;
        }
      else if (PtInRect(mouse_loc, *h.topics))
        {
        /* click was in topics list so find which
         * topic was selected and display the
         * proper HELP resource */
        LClick(mouse_loc, ep->modifiers, 
               h.topics);
        a_cell = 0;
        if (LGetSelect(TRUE, &a_cell, h.topics))
          cell_num = HiWord(a_cell);
        if (cell_num >= 0 && 
            cell_num != h.last_one)
          {
          /* get rid of the old text */
          TEDeactivate(h.text);
          TESetSelect(0L, 32767L, h.text);
          TEDelete(h.text);
          if (cell_num < h.num_topics)
            {
            the_help = GetResource('HELP', 
                          h.help_id[cell_num]);
            buf_size = SizeResource(the_help);
            }
          else /* no topic selected so no help */
            buf_size = 0;
          if (buf_size > 0)
            {
            HLock(the_help);
            TEInsert(*the_help, (long)buf_size, 
                     h.text);
            HUnlock(the_help);
            }
          
          /* reset the scroll bar */
          SetCtlValue(h.text_scroll, 0);
          /* reposition the help text */
          delta = h.offset - 
                  GetCtlValue(h.text_scroll);
          TEScroll(0, delta, h.text);
          h.offset -= delta;
          /* scroll bar necessary? */
          if ((*h.text)->nLines > h.lines_vis)
            {
            HiliteControl(h.text_scroll, 
                          ACTIVATE);
            h.max_text = (((*h.text)->nLines) - 
                         h.lines_vis) * 
                         (*h.text)->lineHeight;
            SetCtlMax(h.text_scroll, h.max_text); 
            }
          else
            HiliteControl(h.text_scroll, 
                          INACTIVATE);
          /* finally, save the new topic */
          h.last_one = cell_num;
          }
        return TRUE;
        }
      return FALSE;
  
    default:
      return FALSE;
    }
  } 

/************************************************
 * This routine is called by the Toolbox while 
 * executing the TrackControl() routine. It has 
 * to take care of scrolling the text when the 
 * up/down arrow and page parts of the scrollbar 
 * are clicked in. */
pascal void help_action(the_scroll, partcode)
ControlHandle the_scroll;
int partcode;
  {
  int value, delta;
  
  switch (partcode)
    {
    case inUpButton:
      value = GetCtlValue(the_scroll);
      value = (value-(*h.text)->lineHeight > 0)
       ? value-(*h.text)->lineHeight 
       : 0;
      SetCtlValue(the_scroll, value);
      break;
    case inPageUp:  /* move 6 lines at a time */
      value = GetCtlValue(the_scroll);
      value = (value-6*(*h.text)->lineHeight > 0)
       ? value-6*(*h.text)->lineHeight 
       : 0;
      SetCtlValue(the_scroll, value);
      break;
    case inDownButton:
      value = GetCtlValue(the_scroll);
      value = (value + (*h.text)->lineHeight < 
               h.max_text) 
       ? value + (*h.text)->lineHeight 
       : h.max_text;
      SetCtlValue(the_scroll, value);
      break;
    case inPageDown:/* move 6 lines at a time */
      value = GetCtlValue(the_scroll);
      value = (value + 6*(*h.text)->lineHeight < 
              h.max_text) 
       ? value + 6*(*h.text)->lineHeight 
       : h.max_text;
      SetCtlValue(the_scroll, value);
      break;
    }
  
  delta = h.offset - GetCtlValue(h.text_scroll);
  TEScroll(0, delta, h.text);
  h.offset -= delta;
  }

/*********************************************************
 * atoi.c - much smaller than unix & stdio libraries 
 *
 * WN Rausch
 * January 1987
 **********************************************************/

#include <MacTypes.h>
#include <pascal.h>
#include <strings.h>

#define isspace(c) (c == ' ' || c == '\t')
#define ZERO 48

/*********************************************************/
atoi(string)
register char *string;   /* must be NULL terminated */
  {
  register long answer = 0L;
  Boolean negative = FALSE;
  
  while (isspace(*string))
   string++;
  if (*string == '-')
   negative = TRUE;  
  while (*string)
   {
   answer = (answer * 10) + (*string - ZERO);
   string++;
   }  
  if (negative)
   answer = 0 - answer; 
  return (int)answer;
  }

/* Resource File for Help.rsrc in Rez MPW Format. Note that the help 
string resources are given here in ascii format and should be typed in 
with ResEdit as in this form, Rez probably will gag. */

resource 'DITL' (256, "help", purgeable) {
 { /* array DITLarray: 3 elements */
 /* [1] */
 {244, 171, 263, 243},
 Button {
 enabled,
 "OK"
 };
 /* [2] */
 {36, 172, 231, 401},
 UserItem {
 enabled
 };
 /* [3] */
 {36, 7, 231, 165},
 UserItem {
 enabled
 }
 }
};
resource 'DLOG' (256, "help", purgeable) {
 {40, 52, 314, 460},
 dBoxProc,
 invisible,
 noGoAway,
 0x0,
 256,
 "help"
};
resource 'MENU' (256, "File", preload) {
 256,
 textMenuProc,
 allEnabled,
 enabled,
 "File",
 { /* array: 3 elements */
 /* [1] */
 "About...", noIcon, noKey, noMark, plain;
 /* [2] */
 "Help demo...", noIcon, noKey, noMark, plain;
 /* [3] */
 "Quit", noIcon, noKey, noMark, plain
 }
};
resource 'STR#' (256, "help topics") {
 { /* array StringArray: 17 elements */
 /* [1] */
 "Introduction\\1";
 /* [2] */
 "More info about HELP\\7";
 /* [3] */
 "And even more\\4";
 /* [4] */
 "Dummy topic 1\\100";
 /* [5] */
 "Dummy topic 2\\101";
 /* [6] */
 "   Dummy sub-topic 2.1\\200";
 /* [7] */
 "   Dummy sub-topic 2.2\\201";
 /* [8] */
 "Dummy topic 3\\400";
 /* [9] */
 "Dummy topic 4\\333";
 /* [10] */
 "   Dummy sub-topic 4.1\\334";
 /* [11] */
 "   Dummy sub-topic 4.2\\332";
 /* [12] */
 "Dummy topic 5\\300";
 /* [13] */
 "Dummy topic 6\\500";
 /* [14] */
 "   Dummy sub-topic 6.1\\332";
 /* [15] */
 "   Dummy sub-topic 6.2\\332";
 /* [16] */
 "   Dummy sub-topic 6.3\\332";
 /* [17] */
 " Dummy sub-topic 7\\335"
 }
};
data 'HELP' (1, "intro", purgeable) {
 This demo program is used to demonstrate the multi-topic on-line help 
function. As many as 100 distinct help topics can exist. (This is adjustable 
by changing the value in: “#define MAX_HELP 100” in help.c)
   Use ResEdit to create the HELP resources (they’re just simple ASCII 
text), or write your own program to create them. 
 Feel free to use this code in your applications. I’d appreciate comments.
 William Rausch
 Battelle, Pacific Northwest Labs
 Math/1406
 Battelle Blvd.
 Richland, WA 99352
 509-375-2249
};

data 'HELP' (100, purgeable) {
 These are just some words. 
};
data 'HELP' (101, purgeable) {
 These are just some words to take space up so that the scroll bar will 
operate. 
};
data 'HELP' (4, "stillmore", purgeable) {
    The help dialog contains an OK button and two boxes, one for the 
list of topics and one to show the help information for the currently 
selected topic. The function builds the list of topics dynamically, using 
a STR# resource number passed to it by the calling routine.
    Each string in the STR# resouce contains a topic and a reference 
number. The reference number is the ID of a HELP resource. Whenever the 
user selects a topic, the ASCII text from the corresponding HELP resource 
is displayed in this scrollable TextEdit record. 
};
data 'HELP' (200, purgeable) {
 MacTutor™ is a great magazine for Macintosh programmers. 
};
data 'HELP' (201, purgeable) {
  Not much here. This must be a dull topic.
};
data 'HELP' (300, purgeable) {
  This will be a HELP resource someday. 
};
data 'HELP' (7, "morehelp", purgeable) {
 It is very easy to create the HELP resources using ResEdit from Apple 
Computer. The version I used is “1.1 minus D”. The biggest improvement 
I’ve noticed is that now you can edit unknown resources as hex or ASCII. 
To create this resource, I just typed into the ASCII portion of the window. 
  
 I’ve also used an editor and ResEdit together in Switcher and that works 
OK too. Set the editor to autowrap though, because you don’t want extraneous 
carriage returns in your HELP resource. Desk Accessory editors work well 
also. 
};
data 'HELP' (500, purgeable) {
 I don’t have much to say here. 
};
data 'HELP' (333, purgeable) {
 Note that any printing characters can be used: ™£¢•¶§. 
};
data 'HELP' (332, purgeable) {
   This particular HELP resource is referenced by several different topics. 
In many cases this can be a useful feature, as many key words may apply 
to the same concept. 
};
data 'HELP' (334, purgeable) {
 This is number 334. 
};
data 'HELP' (400, purgeable) {
 This is number 400. 
};
data 'HELP' (335, purgeable) {
 The very last one is this one for topic seven. 
};
 

Community Search:
MacTech Search:

Software Updates via MacUpdate

Latest Forum Discussions

See All

The Legend of Heroes: Trails of Cold Ste...
I adore game series that have connecting lore and stories, which of course means the Legend of Heroes is very dear to me, Trails lore has been building for two decades. Excitedly, the next stage is upon us as Userjoy has announced the upcoming... | Read more »
Go from lowly lizard to wicked Wyvern in...
Do you like questing, and do you like dragons? If not then boy is this not the announcement for you, as Loongcheer Game has unveiled Quest Dragon: Idle Mobile Game. Yes, it is amazing Square Enix hasn’t sued them for copyright infringement, but... | Read more »
Aether Gazer unveils Chapter 16 of its m...
After a bit of maintenance, Aether Gazer has released Chapter 16 of its main storyline, titled Night Parade of the Beasts. This big update brings a new character, a special outfit, some special limited-time events, and, of course, an engaging... | Read more »
Challenge those pesky wyverns to a dance...
After recently having you do battle against your foes by wildly flailing Hello Kitty and friends at them, GungHo Online has whipped out another surprising collaboration for Puzzle & Dragons. It is now time to beat your opponents by cha-cha... | Read more »
Pack a magnifying glass and practice you...
Somehow it has already been a year since Torchlight: Infinite launched, and XD Games is celebrating by blending in what sounds like a truly fantastic new update. Fans of Cthulhu rejoice, as Whispering Mist brings some horror elements, and tests... | Read more »
Summon your guild and prepare for war in...
Netmarble is making some pretty big moves with their latest update for Seven Knights Idle Adventure, with a bunch of interesting additions. Two new heroes enter the battle, there are events and bosses abound, and perhaps most interesting, a huge... | Read more »
Make the passage of time your plaything...
While some of us are still waiting for a chance to get our hands on Ash Prime - yes, don’t remind me I could currently buy him this month I’m barely hanging on - Digital Extremes has announced its next anticipated Prime Form for Warframe. Starting... | Read more »
If you can find it and fit through the d...
The holy trinity of amazing company names have come together, to release their equally amazing and adorable mobile game, Hamster Inn. Published by HyperBeard Games, and co-developed by Mum Not Proud and Little Sasquatch Studios, it's time to... | Read more »
Amikin Survival opens for pre-orders on...
Join me on the wonderful trip down the inspiration rabbit hole; much as Palworld seemingly “borrowed” many aspects from the hit Pokemon franchise, it is time for the heavily armed animal survival to also spawn some illegitimate children as Helio... | Read more »
PUBG Mobile teams up with global phenome...
Since launching in 2019, SpyxFamily has exploded to damn near catastrophic popularity, so it was only a matter of time before a mobile game snapped up a collaboration. Enter PUBG Mobile. Until May 12th, players will be able to collect a host of... | Read more »

Price Scanner via MacPrices.net

Apple is offering significant discounts on 16...
Apple has a full line of 16″ M3 Pro and M3 Max MacBook Pros available, Certified Refurbished, starting at $2119 and ranging up to $600 off MSRP. Each model features a new outer case, shipping is free... Read more
Apple HomePods on sale for $30-$50 off MSRP t...
Best Buy is offering a $30-$50 discount on Apple HomePods this weekend on their online store. The HomePod mini is on sale for $69.99, $30 off MSRP, while Best Buy has the full-size HomePod on sale... Read more
Limited-time sale: 13-inch M3 MacBook Airs fo...
Amazon has the base 13″ M3 MacBook Air (8GB/256GB) in stock and on sale for a limited time for $989 shipped. That’s $110 off MSRP, and it’s the lowest price we’ve seen so far for an M3-powered... Read more
13-inch M2 MacBook Airs in stock today at App...
Apple has 13″ M2 MacBook Airs available for only $849 today in their Certified Refurbished store. These are the cheapest M2-powered MacBooks for sale at Apple. Apple’s one-year warranty is included,... Read more
New today at Apple: Series 9 Watches availabl...
Apple is now offering Certified Refurbished Apple Watch Series 9 models on their online store for up to $80 off MSRP, starting at $339. Each Watch includes Apple’s standard one-year warranty, a new... Read more
The latest Apple iPhone deals from wireless c...
We’ve updated our iPhone Price Tracker with the latest carrier deals on Apple’s iPhone 15 family of smartphones as well as previous models including the iPhone 14, 13, 12, 11, and SE. Use our price... Read more
Boost Mobile will sell you an iPhone 11 for $...
Boost Mobile, an MVNO using AT&T and T-Mobile’s networks, is offering an iPhone 11 for $149.99 when purchased with their $40 Unlimited service plan (12GB of premium data). No trade-in is required... Read more
Free iPhone 15 plus Unlimited service for $60...
Boost Infinite, part of MVNO Boost Mobile using AT&T and T-Mobile’s networks, is offering a free 128GB iPhone 15 for $60 per month including their Unlimited service plan (30GB of premium data).... Read more
$300 off any new iPhone with service at Red P...
Red Pocket Mobile has new Apple iPhones on sale for $300 off MSRP when you switch and open up a new line of service. Red Pocket Mobile is a nationwide MVNO using all the major wireless carrier... Read more
Clearance 13-inch M1 MacBook Airs available a...
Apple has clearance 13″ M1 MacBook Airs, Certified Refurbished, available for $759 for 8-Core CPU/7-Core GPU/256GB models and $929 for 8-Core CPU/8-Core GPU/512GB models. Apple’s one-year warranty is... Read more

Jobs Board

Operating Room Assistant - *Apple* Hill Sur...
Operating Room Assistant - Apple Hill Surgical Center - Day Location: WellSpan Health, York, PA Schedule: Full Time Sign-On Bonus Eligible Remote/Hybrid Regular Read more
Solutions Engineer - *Apple* - SHI (United...
**Job Summary** An Apple Solution Engineer's primary role is tosupport SHI customers in their efforts to select, deploy, and manage Apple operating systems and Read more
DMR Technician - *Apple* /iOS Systems - Haml...
…relevant point-of-need technology self-help aids are available as appropriate. ** Apple Systems Administration** **:** Develops solutions for supporting, deploying, Read more
Omnichannel Associate - *Apple* Blossom Mal...
Omnichannel Associate - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Read more
Operations Associate - *Apple* Blossom Mall...
Operations Associate - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Read more
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.