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. 
};
 
AAPL
$111.78
Apple Inc.
-0.87
MSFT
$47.66
Microsoft Corpora
+0.14
GOOG
$516.35
Google Inc.
+5.25

MacTech Search:
Community Search:

Software Updates via MacUpdate

LibreOffice 4.3.5.2 - Free Open Source o...
LibreOffice is an office suite (word processor, spreadsheet, presentations, drawing tool) compatible with other major office suites. The Document Foundation is coordinating development and... Read more
CleanApp 5.0.0 Beta 5 - Application dein...
CleanApp is an application deinstaller and archiver.... Your hard drive gets fuller day by day, but do you know why? CleanApp 5 provides you with insights how to reclaim disk space. There are... Read more
Monolingual 1.6.2 - Remove unwanted OS X...
Monolingual is a program for removing unnecesary language resources from OS X, in order to reclaim several hundred megabytes of disk space. It requires a 64-bit capable Intel-based Mac and at least... Read more
NetShade 6.1 - Browse privately using an...
NetShade is an Internet security tool that conceals your IP address on the web. NetShade routes your Web connection through either a public anonymous proxy server, or one of NetShade's own dedicated... Read more
calibre 2.13 - Complete e-library manage...
Calibre is a complete e-book library manager. Organize your collection, convert your books to multiple formats, and sync with all of your devices. Let Calibre be your multi-tasking digital librarian... Read more
Mellel 3.3.7 - Powerful word processor w...
Mellel is the leading word processor for OS X and has been widely considered the industry standard since its inception. Mellel focuses on writers and scholars for technical writing and multilingual... Read more
ScreenFlow 5.0.1 - Create screen recordi...
Save 10% with the exclusive MacUpdate coupon code: AFMacUpdate10 Buy now! ScreenFlow is powerful, easy-to-use screencasting software for the Mac. With ScreenFlow you can record the contents of your... Read more
Simon 4.0 - Monitor changes and crashes...
Simon monitors websites and alerts you of crashes and changes. Select pages to monitor, choose your alert options, and customize your settings. Simon does the rest. Keep a watchful eye on your... Read more
BBEdit 11.0.2 - Powerful text and HTML e...
BBEdit is the leading professional HTML and text editor for the Mac. Specifically crafted in response to the needs of Web authors and software developers, this award-winning product provides a... Read more
ExpanDrive 4.2.1 - Access cloud storage...
ExpanDrive builds cloud storage in every application, acts just like a USB drive plugged into your Mac. With ExpanDrive, you can securely access any remote file server directly from the Finder or... Read more

Latest Forum Discussions

See All

Make your own Tribez Figures (and More)...
Make your own Tribez Figures (and More) with Toyze Posted by Jessica Fisher on December 19th, 2014 [ permalink ] Universal App - Designed for iPhone and iPad | Read more »
So Many Holiday iOS Sales Oh My Goodness...
The holiday season is in full-swing, which means a whole lot of iOS apps and games are going on sale. A bunch already have, in fact. Naturally this means we’re putting together a hand-picked list of the best discounts and sales we can find in order... | Read more »
It’s Bird vs. Bird in the New PvP Mode f...
It’s Bird vs. Bird in the New PvP Mode for Angry Birds Epic Posted by Jessica Fisher on December 19th, 2014 [ permalink ] Universal App - Designed for iPhone and iPad | Read more »
Telltale Games and Mojang Announce Minec...
Telltale Games and Mojang Announce Minecraft: Story Mode – A Telltale Games Series Posted by Jessica Fisher on December 19th, 2014 [ permalink ] | Read more »
WarChest and Splash Damage Annouce Their...
WarChest and Splash Damage Annouce Their New Game: Tempo Posted by Jessica Fisher on December 19th, 2014 [ permalink ] WarChest Ltd and Splash Damage Ltd are teaming up again to work | Read more »
BulkyPix Celebrates its 6th Anniversary...
BulkyPix Celebrates its 6th Anniversary with a Bunch of Free Games Posted by Jessica Fisher on December 19th, 2014 [ permalink ] BulkyPix has | Read more »
Indulge in Japanese cuisine in Cooking F...
Indulge in Japanese cuisine in Cooking Fever’s new sushi-themed update Posted by Simon Reed on December 19th, 2014 [ permalink ] Lithuanian developer Nordcurrent has yet again updated its restaurant simulat | Read more »
Badland Daydream Level Pack Arrives to C...
Badland Daydream Level Pack Arrives to Celebrate 20 Million Downloads Posted by Ellis Spice on December 19th, 2014 [ permalink ] | Read more »
Far Cry 4, Assassin’s Creed Unity, Desti...
Far Cry 4, Assassin’s Creed Unity, Destiny, and Beyond – AppSpy Takes a Look at AAA Companion Apps Posted by Rob Rich on December 19th, 2014 [ permalink ] These day | Read more »
A Bunch of Halfbrick Games Are Going Fre...
A Bunch of Halfbrick Games Are Going Free for the Holidays Posted by Ellis Spice on December 19th, 2014 [ permalink ] Universal App - Designed for iPhone and iPad | Read more »

Price Scanner via MacPrices.net

Kodak Returns to CES With New Consumer Produ...
Former photography colossus Kodak is returning to CES for the first time in three years where the Kodak booth (#21818 South Hall 1) will showcase a wide range of innovative, imaging-related products... Read more
Invaluable Launches New Eponymously -Named A...
Invaluable, the world’s largest online live auction marketplace, hhas announced the official launch of the Invaluable app for iPad, now available for download in the iTunes App Store. Invaluable... Read more
IDC Reveals Worldwide Mobile Enterprise Appli...
International Data Corporation (IDC) last week hosted the IDC FutureScape: Worldwide Mobile Enterprise Applications and Solutions 2015 Predictions Web conference. The session provided organizations... Read more
Hello Vino Wine App Launches “Safe Ride Home”...
Hello Vino has announced addition of a new “Get a Safe Ride Home” feature in its Food & Drink app with a direct connection to Uber, the technology platform that connects users with rides. The... Read more
DEVON-technologies Releases DEVONthink To Go...
Coeur d’Alene, Idaho based DEVON-technologies, LLC has updated DEVONthink To Go, its mobile companion to DEVONthink, to version 1.5. The update includes an iOS 8 extension, compatibility with the... Read more
The Apple Store offering free next-day shippi...
The Apple Store is now offering free next-day shipping on all in stock items if ordered before 12/23/14 at 10:00am PT. Local store pickup is also available within an hour of ordering for any in stock... Read more
It’s 1992 Again At Sony Pictures, Except For...
Techcrunch’s John Biggs interviewed a Sony Pictures Entertainment (SPE) employee, who quite understandably wished to remain anonymous, regarding post-hack conditions in SPE’s L.A office, explaining “... Read more
Holiday sales this weekend: MacBook Pros for...
 B&H Photo has new MacBook Pros on sale for up to $300 off MSRP as part of their Holiday pricing. Shipping is free, and B&H charges NY sales tax only: - 15″ 2.2GHz Retina MacBook Pro: $1699... Read more
Holiday sales this weekend: MacBook Airs for...
B&H Photo has 2014 MacBook Airs on sale for up to $120 off MSRP, for a limited time, for the Thanksgiving/Christmas Holiday shopping season. Shipping is free, and B&H charges NY sales tax... Read more
Holiday sales this weekend: iMacs for up to $...
B&H Photo has 21″ and 27″ iMacs on sale for up to $200 off MSRP including free shipping plus NY sales tax only. B&H will also include a free copy of Parallels Desktop software: - 21″ 1.4GHz... Read more

Jobs Board

*Apple* Store Leader Program (US) - Apple, I...
…Summary Learn and grow as you explore the art of leadership at the Apple Store. You'll master our retail business inside and out through training, hands-on experience, Read more
Project Manager, *Apple* Financial Services...
**Job Summary** Apple Financial Services (AFS) offers consumers, businesses and educational institutions ways to finance Apple purchases. We work with national and Read more
*Apple* Retail - Multiple Positions (US) - A...
Sales Specialist - Retail Customer Service and Sales Transform Apple Store visitors into loyal Apple customers. When customers enter the store, you're also the Read more
*Apple* Retail - Multiple Positions (US) - A...
Sales Specialist - Retail Customer Service and Sales Transform Apple Store visitors into loyal Apple customers. When customers enter the store, you're also the Read more
*Apple* Retail - Multiple Positions (US) - A...
Job Description: Sales Specialist - Retail Customer Service and Sales Transform Apple Store visitors into loyal Apple customers. When customers enter the store, Read more
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.