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

Top Mobile Game Discounts
Every day, we pick out a curated list of the best mobile discounts on the App Store and post them here. This list won't be comprehensive, but it every game on it is recommended. Feel free to check out the coverage we did on them in the links... | Read more »
Price of Glory unleashes its 1.4 Alpha u...
As much as we all probably dislike Maths as a subject, we do have to hand it to geometry for giving us the good old Hexgrid, home of some of the best strategy games. One such example, Price of Glory, has dropped its 1.4 Alpha update, stocked full... | Read more »
The SLC 2025 kicks off this month to cro...
Ever since the Solo Leveling: Arise Championship 2025 was announced, I have been looking forward to it. The promotional clip they released a month or two back showed crowds going absolutely nuts for the previous competitions, so imagine the... | Read more »
Dive into some early Magicpunk fun as Cr...
Excellent news for fans of steampunk and magic; the Precursor Test for Magicpunk MMORPG Crystal of Atlan opens today. This rather fancy way of saying beta test will remain open until March 5th and is available for PC - boo - and Android devices -... | Read more »
Prepare to get your mind melted as Evang...
If you are a fan of sci-fi shooters and incredibly weird, mind-bending anime series, then you are in for a treat, as Goddess of Victory: Nikke is gearing up for its second collaboration with Evangelion. We were also treated to an upcoming... | Read more »
Square Enix gives with one hand and slap...
We have something of a mixed bag coming over from Square Enix HQ today. Two of their mobile games are revelling in life with new events keeping them alive, whilst another has been thrown onto the ever-growing discard pile Square is building. I... | Read more »
Let the world burn as you have some fest...
It is time to leave the world burning once again as you take a much-needed break from that whole “hero” lark and enjoy some celebrations in Genshin Impact. Version 5.4, Moonlight Amidst Dreams, will see you in Inazuma to attend the Mikawa Flower... | Read more »
Full Moon Over the Abyssal Sea lands on...
Aether Gazer has announced its latest major update, and it is one of the loveliest event names I have ever heard. Full Moon Over the Abyssal Sea is an amazing name, and it comes loaded with two side stories, a new S-grade Modifier, and some fancy... | Read more »
Open your own eatery for all the forest...
Very important question; when you read the title Zoo Restaurant, do you also immediately think of running a restaurant in which you cook Zoo animals as the course? I will just assume yes. Anyway, come June 23rd we will all be able to start up our... | Read more »
Crystal of Atlan opens registration for...
Nuverse was prominently featured in the last month for all the wrong reasons with the USA TikTok debacle, but now it is putting all that behind it and preparing for the Crystal of Atlan beta test. Taking place between February 18th and March 5th,... | Read more »

Price Scanner via MacPrices.net

AT&T is offering a 65% discount on the ne...
AT&T is offering the new iPhone 16e for up to 65% off their monthly finance fee with 36-months of service. No trade-in is required. Discount is applied via monthly bill credits over the 36 month... Read more
Use this code to get a free iPhone 13 at Visi...
For a limited time, use code SWEETDEAL to get a free 128GB iPhone 13 Visible, Verizon’s low-cost wireless cell service, Visible. Deal is valid when you purchase the Visible+ annual plan. Free... Read more
M4 Mac minis on sale for $50-$80 off MSRP at...
B&H Photo has M4 Mac minis in stock and on sale right now for $50 to $80 off Apple’s MSRP, each including free 1-2 day shipping to most US addresses: – M4 Mac mini (16GB/256GB): $549, $50 off... Read more
Buy an iPhone 16 at Boost Mobile and get one...
Boost Mobile, an MVNO using AT&T and T-Mobile’s networks, is offering one year of free Unlimited service with the purchase of any iPhone 16. Purchase the iPhone at standard MSRP, and then choose... Read more
Get an iPhone 15 for only $299 at Boost Mobil...
Boost Mobile, an MVNO using AT&T and T-Mobile’s networks, is offering the 128GB iPhone 15 for $299.99 including service with their Unlimited Premium plan (50GB of premium data, $60/month), or $20... Read more
Unreal Mobile is offering $100 off any new iP...
Unreal Mobile, an MVNO using AT&T and T-Mobile’s networks, is offering a $100 discount on any new iPhone with service. This includes new iPhone 16 models as well as iPhone 15, 14, 13, and SE... Read more
Apple drops prices on clearance iPhone 14 mod...
With today’s introduction of the new iPhone 16e, Apple has discontinued the iPhone 14, 14 Pro, and SE. In response, Apple has dropped prices on unlocked, Certified Refurbished, iPhone 14 models to a... Read more
B&H has 16-inch M4 Max MacBook Pros on sa...
B&H Photo is offering a $360-$410 discount on new 16-inch MacBook Pros with M4 Max CPUs right now. B&H offers free 1-2 day shipping to most US addresses: – 16″ M4 Max MacBook Pro (36GB/1TB/... Read more
Amazon is offering a $100 discount on the M4...
Amazon has the M4 Pro Mac mini discounted $100 off MSRP right now. Shipping is free. Their price is the lowest currently available for this popular mini: – Mac mini M4 Pro (24GB/512GB): $1299, $100... Read more
B&H continues to offer $150-$220 discount...
B&H Photo has 14-inch M4 MacBook Pros on sale for $150-$220 off MSRP. B&H offers free 1-2 day shipping to most US addresses: – 14″ M4 MacBook Pro (16GB/512GB): $1449, $150 off MSRP – 14″ M4... Read more

Jobs Board

All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.