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

Tokkun Studio unveils alpha trailer for...
We are back on the MMORPG news train, and this time it comes from the sort of international developers Tokkun Studio. They are based in France and Japan, so it counts. Anyway, semantics aside, they have released an alpha trailer for the upcoming... | Read more »
Win a host of exclusive in-game Honor of...
To celebrate its latest Jujutsu Kaisen crossover event, Honor of Kings is offering a bounty of login and achievement rewards kicking off the holiday season early. [Read more] | Read more »
Miraibo GO comes out swinging hard as it...
Having just launched what feels like yesterday, Dreamcube Studio is wasting no time adding events to their open-world survival Miraibo GO. Abyssal Souls arrives relatively in time for the spooky season and brings with it horrifying new partners to... | Read more »
Ditch the heavy binders and high price t...
As fun as the real-world equivalent and the very old Game Boy version are, the Pokemon Trading Card games have historically been received poorly on mobile. It is a very strange and confusing trend, but one that The Pokemon Company is determined to... | Read more »
Peace amongst mobile gamers is now shatt...
Some of the crazy folk tales from gaming have undoubtedly come from the EVE universe. Stories of spying, betrayal, and epic battles have entered history, and now the franchise expands as CCP Games launches EVE Galaxy Conquest, a free-to-play 4x... | Read more »
Lord of Nazarick, the turn-based RPG bas...
Crunchyroll and A PLUS JAPAN have just confirmed that Lord of Nazarick, their turn-based RPG based on the popular OVERLORD anime, is now available for iOS and Android. Starting today at 2PM CET, fans can download the game from Google Play and the... | Read more »
Digital Extremes' recent Devstream...
If you are anything like me you are impatiently waiting for Warframe: 1999 whilst simultaneously cursing the fact Excalibur Prime is permanently Vault locked. To keep us fed during our wait, Digital Extremes hosted a Double Devstream to dish out a... | Read more »
The Frozen Canvas adds a splash of colou...
It is time to grab your gloves and layer up, as Torchlight: Infinite is diving into the frozen tundra in its sixth season. The Frozen Canvas is a colourful new update that brings a stylish flair to the Netherrealm and puts creativity in the... | Read more »
Back When AOL WAS the Internet – The Tou...
In Episode 606 of The TouchArcade Show we kick things off talking about my plans for this weekend, which has resulted in this week’s show being a bit shorter than normal. We also go over some more updates on our Patreon situation, which has been... | Read more »
Creative Assembly's latest mobile p...
The Total War series has been slowly trickling onto mobile, which is a fantastic thing because most, if not all, of them are incredibly great fun. Creative Assembly's latest to get the Feral Interactive treatment into portable form is Total War:... | Read more »

Price Scanner via MacPrices.net

Early Black Friday Deal: Apple’s newly upgrad...
Amazon has Apple 13″ MacBook Airs with M2 CPUs and 16GB of RAM on early Black Friday sale for $200 off MSRP, only $799. Their prices are the lowest currently available for these newly upgraded 13″ M2... Read more
13-inch 8GB M2 MacBook Airs for $749, $250 of...
Best Buy has Apple 13″ MacBook Airs with M2 CPUs and 8GB of RAM in stock and on sale on their online store for $250 off MSRP. Prices start at $749. Their prices are the lowest currently available for... Read more
Amazon is offering an early Black Friday $100...
Amazon is offering early Black Friday discounts on Apple’s new 2024 WiFi iPad minis ranging up to $100 off MSRP, each with free shipping. These are the lowest prices available for new minis anywhere... Read more
Price Drop! Clearance 14-inch M3 MacBook Pros...
Best Buy is offering a $500 discount on clearance 14″ M3 MacBook Pros on their online store this week with prices available starting at only $1099. Prices valid for online orders only, in-store... Read more
Apple AirPods Pro with USB-C on early Black F...
A couple of Apple retailers are offering $70 (28%) discounts on Apple’s AirPods Pro with USB-C (and hearing aid capabilities) this weekend. These are early AirPods Black Friday discounts if you’re... Read more
Price drop! 13-inch M3 MacBook Airs now avail...
With yesterday’s across-the-board MacBook Air upgrade to 16GB of RAM standard, Apple has dropped prices on clearance 13″ 8GB M3 MacBook Airs, Certified Refurbished, to a new low starting at only $829... Read more
Price drop! Apple 15-inch M3 MacBook Airs now...
With yesterday’s release of 15-inch M3 MacBook Airs with 16GB of RAM standard, Apple has dropped prices on clearance Certified Refurbished 15″ 8GB M3 MacBook Airs to a new low starting at only $999.... Read more
Apple has clearance 15-inch M2 MacBook Airs a...
Apple has clearance, Certified Refurbished, 15″ M2 MacBook Airs now available starting at $929 and ranging up to $410 off original MSRP. These are the cheapest 15″ MacBook Airs for sale today at... Read more
Apple drops prices on 13-inch M2 MacBook Airs...
Apple has dropped prices on 13″ M2 MacBook Airs to a new low of only $749 in their Certified Refurbished store. These are the cheapest M2-powered MacBooks for sale at Apple. Apple’s one-year warranty... Read more
Clearance 13-inch M1 MacBook Airs available a...
Apple has clearance 13″ M1 MacBook Airs, Certified Refurbished, now available for $679 for 8-Core CPU/7-Core GPU/256GB models. Apple’s one-year warranty is included, shipping is free, and each... Read more

Jobs Board

Seasonal Cashier - *Apple* Blossom Mall - J...
Seasonal Cashier - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Read more
Seasonal Fine Jewelry Commission Associate -...
…Fine Jewelry Commission Associate - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) Read more
Seasonal Operations Associate - *Apple* Blo...
Seasonal Operations Associate - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Read more
Hair Stylist - *Apple* Blossom Mall - JCPen...
Hair Stylist - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Blossom Read more
Cashier - *Apple* Blossom Mall - JCPenney (...
Cashier - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Blossom Mall Read more
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.