home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / windows / x / motif / 5945 < prev    next >
Encoding:
Internet Message Format  |  1992-09-01  |  2.5 KB

  1. Path: sparky!uunet!olivea!decwrl!csus.edu!netcom.com!qualtrak
  2. From: qualtrak@netcom.com (Qual Trak)
  3. Newsgroups: comp.windows.x.motif
  4. Subject: HelpCallbacks under SUN or Overriding <Key>: translations
  5. Keywords: HelpCallback Motif SUN XtOverrideTranslations
  6. Message-ID: <dzjnc7j.qualtrak@netcom.com>
  7. Date: 1 Sep 92 19:11:08 GMT
  8. Reply-To: jb@QualTrak.COM
  9. Distribution: usa
  10. Organization: QualTrak Corporation
  11. Lines: 49
  12.  
  13. I'm trying to hook help callbacks into my Motif application (I'm
  14. running Quest Motif v1.1.4 under X11R5 on SunOS 4.1.2) and I'm
  15. encountering a few problems.  After banging around with no effect as to
  16. why my XmNhelpCallback callbacks were being called I found in Heller's
  17. book (O'Reilly vol 6) on page 667 as a footnote:
  18.  
  19.     "By default Sun workstations do not generate the proper event when
  20.      the Help key is pressed.  Your mileage may vary with other
  21.      computers."
  22.  
  23. So I tried playing around and found I could explicitly override the
  24. translations of a widget with a call to XtOverrideTranslations ().  I
  25. used the following code 
  26.  
  27.     static XtTranslations h_trans;
  28.     static char HelpTranslations [] =
  29.         "<Key>Help: PrimitiveHelp()";
  30.     static int initialized = False;
  31.  
  32.     if (!initialized)
  33.     {
  34.         h_trans = XtParseTranslationTable (HelpTranslations);
  35.         initialized = True;
  36.     }
  37.     XtOverrideTranslations (w, h_trans);
  38.     XtAddCallback (w, XmNhelpCallback,
  39.                    (XtCallbackkProc) my_help_callback, help_name);
  40.  
  41. I got an error about not being able to find the action (PrimitiveHelp())
  42. but when I pressed a button, the help routine was called. I think I can
  43. get rid of the warning message by using Help() instead of
  44. PrimitiveHelp().  My basic question is that I would like to be able to
  45. specify the help action in the resource database but I can't get this to
  46. happen (I've encountered this before when I had a Widget I wanted to get
  47. the <Key>Return action on.  I had to use the technique shown above.  In
  48. that case I could get every key BUT the <Return> key.
  49.  
  50. So I guess what I'm asking is
  51.  
  52.     1.  Is there a clean way to get the help callback functionality
  53.         under SunOS.
  54.  
  55.     2.  Why can't I override keyboard translations in the Resource
  56.         Database instead of having to hardcode it with an
  57.         XtOverrideTranslations call?
  58. ------------------------------------------------------------------------
  59. John Birchfield - QualTrak Corp (408) 730-2674 Home (408) 736-3852
  60. jb@QualTrak.COM
  61. ------------------------------------------------------------------------
  62.