home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!olivea!decwrl!csus.edu!netcom.com!qualtrak
- From: qualtrak@netcom.com (Qual Trak)
- Newsgroups: comp.windows.x.motif
- Subject: HelpCallbacks under SUN or Overriding <Key>: translations
- Keywords: HelpCallback Motif SUN XtOverrideTranslations
- Message-ID: <dzjnc7j.qualtrak@netcom.com>
- Date: 1 Sep 92 19:11:08 GMT
- Reply-To: jb@QualTrak.COM
- Distribution: usa
- Organization: QualTrak Corporation
- Lines: 49
-
- I'm trying to hook help callbacks into my Motif application (I'm
- running Quest Motif v1.1.4 under X11R5 on SunOS 4.1.2) and I'm
- encountering a few problems. After banging around with no effect as to
- why my XmNhelpCallback callbacks were being called I found in Heller's
- book (O'Reilly vol 6) on page 667 as a footnote:
-
- "By default Sun workstations do not generate the proper event when
- the Help key is pressed. Your mileage may vary with other
- computers."
-
- So I tried playing around and found I could explicitly override the
- translations of a widget with a call to XtOverrideTranslations (). I
- used the following code
-
- static XtTranslations h_trans;
- static char HelpTranslations [] =
- "<Key>Help: PrimitiveHelp()";
- static int initialized = False;
-
- if (!initialized)
- {
- h_trans = XtParseTranslationTable (HelpTranslations);
- initialized = True;
- }
- XtOverrideTranslations (w, h_trans);
- XtAddCallback (w, XmNhelpCallback,
- (XtCallbackkProc) my_help_callback, help_name);
-
- I got an error about not being able to find the action (PrimitiveHelp())
- but when I pressed a button, the help routine was called. I think I can
- get rid of the warning message by using Help() instead of
- PrimitiveHelp(). My basic question is that I would like to be able to
- specify the help action in the resource database but I can't get this to
- happen (I've encountered this before when I had a Widget I wanted to get
- the <Key>Return action on. I had to use the technique shown above. In
- that case I could get every key BUT the <Return> key.
-
- So I guess what I'm asking is
-
- 1. Is there a clean way to get the help callback functionality
- under SunOS.
-
- 2. Why can't I override keyboard translations in the Resource
- Database instead of having to hardcode it with an
- XtOverrideTranslations call?
- ------------------------------------------------------------------------
- John Birchfield - QualTrak Corp (408) 730-2674 Home (408) 736-3852
- jb@QualTrak.COM
- ------------------------------------------------------------------------
-