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

Dropbox 193.4.5594 - Cloud backup and sy...
Dropbox is a file hosting service that provides cloud storage, file synchronization, personal cloud, and client software. It is a modern workspace that allows you to get to all of your files, manage... Read more
Google Chrome 122.0.6261.57 - Modern and...
Google Chrome is a Web browser by Google, created to be a modern platform for Web pages and applications. It utilizes very fast loading of Web pages and has a V8 engine, which is a custom built... Read more
Skype 8.113.0.210 - Voice-over-internet...
Skype is a telecommunications app that provides HD video calls, instant messaging, calling to any phone number or landline, and Skype for Business for productive cooperation on the projects. This... Read more
Tor Browser 13.0.10 - Anonymize Web brow...
Using Tor Browser you can protect yourself against tracking, surveillance, and censorship. Tor was originally designed, implemented, and deployed as a third-generation onion-routing project of the U.... Read more
Deeper 3.0.4 - Enable hidden features in...
Deeper is a personalization utility for macOS which allows you to enable and disable the hidden functions of the Finder, Dock, QuickTime, Safari, iTunes, login window, Spotlight, and many of Apple's... Read more
OnyX 4.5.5 - Maintenance and optimizatio...
OnyX is a multifunction utility that you can use to verify the startup disk and the structure of its system files, to run miscellaneous maintenance and cleaning tasks, to configure parameters in the... Read more
Hopper Disassembler 5.14.1 - Binary disa...
Hopper Disassembler is a binary disassembler, decompiler, and debugger for 32- and 64-bit executables. It will let you disassemble any binary you want, and provide you all the information about its... Read more

Latest Forum Discussions

See All

Zenless Zone Zero opens entries for its...
miHoYo, aka HoYoverse, has become such a big name in mobile gaming that it's hard to believe that arguably their flagship title, Genshin Impact, is only three and a half years old. Now, they continue the road to the next title in their world, with... | Read more »
Live, Playdate, Live! – The TouchArcade...
In this week’s episode of The TouchArcade Show we kick things off by talking about all the games I splurged on during the recent Playdate Catalog one-year anniversary sale, including the new Lucas Pope jam Mars After Midnight. We haven’t played any... | Read more »
TouchArcade Game of the Week: ‘Vroomies’
So here’s a thing: Vroomies from developer Alex Taber aka Unordered Games is the Game of the Week! Except… Vroomies came out an entire month ago. It wasn’t on my radar until this week, which is why I included it in our weekly new games round-up, but... | Read more »
SwitchArcade Round-Up: ‘MLB The Show 24’...
Hello gentle readers, and welcome to the SwitchArcade Round-Up for March 15th, 2024. We’re closing out the week with a bunch of new games, with Sony’s baseball franchise MLB The Show up to bat yet again. There are several other interesting games to... | Read more »
Steam Deck Weekly: WWE 2K24 and Summerho...
Welcome to this week’s edition of the Steam Deck Weekly. The busy season has begun with games we’ve been looking forward to playing including Dragon’s Dogma 2, Horizon Forbidden West Complete Edition, and also console exclusives like Rise of the... | Read more »
Steam Spring Sale 2024 – The 10 Best Ste...
The Steam Spring Sale 2024 began last night, and while it isn’t as big of a deal as say the Steam Winter Sale, you may as well take advantage of it to save money on some games you were planning to buy. I obviously recommend checking out your own... | Read more »
New ‘SaGa Emerald Beyond’ Gameplay Showc...
Last month, Square Enix posted a Let’s Play video featuring SaGa Localization Director Neil Broadley who showcased the worlds, companions, and more from the upcoming and highly-anticipated RPG SaGa Emerald Beyond. | Read more »
Choose Your Side in the Latest ‘Marvel S...
Last month, Marvel Snap (Free) held its very first “imbalance" event in honor of Valentine’s Day. For a limited time, certain well-known couples were given special boosts when conditions were right. It must have gone over well, because we’ve got a... | Read more »
Warframe welcomes the arrival of a new s...
As a Warframe player one of the best things about it launching on iOS, despite it being arguably the best way to play the game if you have a controller, is that I can now be paid to talk about it. To whit, we are gearing up to receive the first... | Read more »
Apple Arcade Weekly Round-Up: Updates an...
Following the new releases earlier in the month and April 2024’s games being revealed by Apple, this week has seen some notable game updates and events go live for Apple Arcade. What The Golf? has an April Fool’s Day celebration event going live “... | Read more »

Price Scanner via MacPrices.net

Apple Education is offering $100 discounts on...
If you’re a student, teacher, or staff member at any educational institution, you can use your .edu email address when ordering at Apple Education to take $100 off the price of a new M3 MacBook Air.... Read more
Apple Watch Ultra 2 with Blood Oxygen feature...
Best Buy is offering Apple Watch Ultra 2 models for $50 off MSRP on their online store this week. Sale prices available for online orders only, in-store prices may vary. Order online, and choose... Read more
New promo at Sams Club: Apple HomePods for $2...
Sams Club has Apple HomePods on sale for $259 through March 31, 2024. Their price is $40 off Apple’s MSRP, and both Space Gray and White colors are available. Sale price is for online orders only, in... Read more
Get Apple’s 2nd generation Apple Pencil for $...
Apple’s Pencil (2nd generation) works with the 12″ iPad Pro (3rd, 4th, 5th, and 6th generation), 11″ iPad Pro (1st, 2nd, 3rd, and 4th generation), iPad Air (4th and 5th generation), and iPad mini (... Read more
10th generation Apple iPads on sale for $100...
Best Buy has Apple’s 10th-generation WiFi iPads back on sale for $100 off MSRP on their online store, starting at only $349. With the discount, Best Buy’s prices are the lowest currently available... Read more
iPad Airs on sale again starting at $449 on B...
Best Buy has 10.9″ M1 WiFi iPad Airs on record-low sale prices again for $150 off Apple’s MSRP, starting at $449. Sale prices for online orders only, in-store price may vary. Order online, and choose... Read more
Best Buy is blowing out clearance 13-inch M1...
Best Buy is blowing out clearance Apple 13″ M1 MacBook Airs this weekend for only $649.99, or $350 off Apple’s original MSRP. Sale prices for online orders only, in-store prices may vary. Order... Read more
Low price alert! You can now get a 13-inch M1...
Walmart has, for the first time, begun offering new Apple MacBooks for sale on their online store, albeit clearance previous-generation models. They now have the 13″ M1 MacBook Air (8GB RAM, 256GB... Read more
Best Apple MacBook deal this weekend: Get the...
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 15-inch M3 MacBook Air (Midnight) on sale...
Amazon has the new 15″ M3 MacBook Air (8GB RAM/256GB SSD/Midnight) in stock and on sale today for $1249.99 including free shipping. Their price is $50 off MSRP, and it’s the lowest price currently... Read more

Jobs Board

Early Preschool Teacher - Glenda Drive/ *Appl...
Early Preschool Teacher - Glenda Drive/ Apple ValleyTeacher Share by Email Share on LinkedIn Share on Twitter Read more
Senior Software Engineer - *Apple* Fundamen...
…center of Microsoft's efforts to empower our users to do more. The Apple Fundamentals team focused on defining and improving the end-to-end developer experience in Read more
Relationship Banker *Apple* Valley Main - W...
…Alcohol Policy to learn more. **Company:** WELLS FARGO BANK **Req Number:** R-350696 **Updated:** Mon Mar 11 00:00:00 UTC 2024 **Location:** APPLE VALLEY,California Read more
Medical Assistant - Surgical Oncology- *Apple...
Medical Assistant - Surgical Oncology- Apple Hill WellSpan Medical Group, York, PA | Nursing | Nursing Support | FTE: 1 | Regular | Tracking Code: 200555 Apply Now Read more
Early Preschool Teacher - Glenda Drive/ *Appl...
Early Preschool Teacher - Glenda Drive/ Apple ValleyTeacher Share by Email Share on LinkedIn Share on Twitter Read more
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.