home *** CD-ROM | disk | FTP | other *** search
/ Danny Amor's Online Library / Danny Amor's Online Library - Volume 1.iso / html / faqs / faq / motif-faq / part4 < prev    next >
Encoding:
Text File  |  1995-07-25  |  59.6 KB  |  1,499 lines

  1. Subject: Motif FAQ (Part 4 of 6)
  2. Newsgroups: comp.windows.x.motif,comp.answers,news.answers
  3. From: ksall@cen.com (Ken Sall)
  4. Date: 11 Oct 1994 07:52:04 GMT
  5.  
  6. Archive-name: motif-faq/part4
  7. Last-modified: OCT 10, 1994
  8. Posting-Frequency: monthly
  9. Organization: Century Computing, Inc.
  10. Version: 3.8
  11.  
  12.  
  13.  
  14. -----------------------------------------------------------------------------
  15. Subject: 107)  How do popup menus work?
  16.  
  17. [Last modified: August 92]
  18.  
  19. Answer:
  20.  
  21. When a popup menu is created as the child of a widget the menu system installs
  22. a translation on the parent of the popup and descendants with an action which:
  23. (1) when 3-rd button (the default for the menuPost resource) is pressed the
  24. cursor changes and the mouse is grabbed for 5 seconds; (2) disables event
  25. handlers on the descendants and the handlers are never called; (3) an event
  26. handler installed on the parent works fine.
  27.  
  28. It is done so that the correct event handler will (in fact) be called.  There
  29. is a grab with owner_events true.  The grab is released by a timer,  but
  30. normally the posted menu shell puts up it's own grab.
  31.  
  32. If you only have widgets then you can use the subwindow field in the event to
  33. identify the original widget.  If you have gadgets or other data that you want
  34. to change the menu for (or use a specific menu for) then you must do a walk of
  35. the parent's children to find the best match.
  36.  
  37. One thing to beware of is that even with the grab,  because the menu system
  38. does a grab with owner events true, you must either have an event handler, or
  39. nothing that will use the event on each widget in the hierarchy of the menu's
  40. parent.  If a child widget has another event handler for button down, it may
  41. swallow the event and do something else.
  42.  
  43. -----------------------------------------------------------------------------
  44. Subject: 108)  Should I use translation tables or actions for popup menus?
  45.  
  46. [Last modified: August 92]
  47.  
  48. Answer: The original goal of popupMenus was that the user would not have to
  49. specify an event handler to manage popupMenus; however, that did not become
  50. reality.  Larry Rogers wrote:
  51.  
  52. > There appear to be two ways to manage popup menus.  I
  53. > am curious what the correct way would be:
  54.  
  55. > 1.  Change the translation table of the widget with the
  56. >    popup child to popup the menu.  Note that this does
  57. >    not currently working for many widgets, because aug-
  58. >    menting their translations, even for augment breaks
  59. >    the widget.
  60.  
  61. > 2.  Add an event handler at creation to the widget; then
  62. >    determine if the event that caused the event handler
  63. >    to be called is the current button being used by the
  64. >    menu as its activation button.
  65.  
  66. Susan Murdock Thompson (from OSF) replied: *Theoretically, you should be able
  67. to do both.*  Our documentation says use event handlers.  Our tests for the
  68. toolkit use event handlers and for UIL use translations.  (Although I tried an
  69. event handler with a UIL test and it works).
  70.  
  71. -----------------------------------------------------------------------------
  72. Subject: 109)  What are the known bugs in popup menus?
  73. [Last modified: August 92]
  74.  
  75. Answer: As at Motif 1.1.4, the bugs for which an OSF PIR exists are:
  76.  
  77.    (3)  Menus not being sticky (ie: posted on a Btn CLICK)  [ Note:this
  78.         problem occurs with OptionMenus as well]  (PIR 3435)
  79.  
  80.    (6)  Destroying a widget with an associated popupMenu results in
  81.         "Warning: Attempt to remove non-existant passive grab"         (PIR
  82. 2972)
  83.  
  84.    (7)  Current documentation insufficient regarding requirements for
  85.         success in using PopupMenus.  (PIR 3433)
  86.  
  87.  
  88. -----------------------------------------------------------------------------
  89. Subject: 110)  Can I have multiple popup menus on the same widget?
  90.  
  91. [Last modified: August 92]
  92.  
  93. Answer: If you want to have several popups (activated by different mouse
  94. buttons) on the same widget..., well, that doesn't work yet.
  95.  
  96. If you want to have several popups on different children... that works.  But
  97. don't put a popup on the parent (manager) widget, or it will rule!
  98.  
  99.  
  100. -----------------------------------------------------------------------------
  101. Subject: 111)  TOPIC: INPUT FOCUS
  102.  
  103. -----------------------------------------------------------------------------
  104. Subject: 112)  How can I specify the widget that should have the keyboard
  105. focus when my application starts up?  Answer: In Motif 1.2, use
  106. XmNinitialFocus on the manager widget.
  107.  
  108. Thanks to Ken Lee, kenton@allegro.esd.sgi.com
  109.  
  110.  
  111. -----------------------------------------------------------------------------
  112. Subject: 113)  How can I direct the keyboard input to a particular widget?
  113.  
  114. Answer: In Motif 1.1 call XmProcessTraversal(target, XmTRAVERSE_CURRENT).  The
  115. widget (and all of its ancestors) does need to be realized BEFORE you call
  116. this. Otherwise it has no effect.  XmProcessTraversal is reported to have many
  117. bugs, so it may not work right.  A common occurrence is that it doesn't move
  118. to the widget, but if you call XmProcessTraversal *twice* in a row, it will.
  119. If you can't get it to work, try this from Kee Hinckley:
  120.  
  121.     // This insane sequence is as follows:
  122.     //      On manage set up a focus callback
  123.     //      On focus callback set up a timer (and get rid of focus callback!)
  124.     //      On timer set the focus (which only works if the parent
  125.     //      has the focus,
  126.     //      which is why we went through all of this garbage)
  127.     // There may be a better way, but I haven't time to try it now.
  128.     //
  129.     static void focusTO(void *data, XtIntervalId *) {
  130.         XmProcessTraversal((Widget) data, XmTRAVERSE_CURRENT);
  131.     }
  132.  
  133.     static void focusCB(Widget w, XtPointer data, XtPointer) {
  134.         XtRemoveCallback(w, XmNfocusCallback, focusCB, data);
  135.         XtAppAddTimeOut(XtWidgetToApplicationContext(w), 0, focusTO, data);
  136.     }
  137.  
  138.     void OmXSetFocus(Widget parent, Widget w) {
  139.         XtAddCallback(parent, XmNfocusCallback, focusCB, w);
  140.     }
  141.  
  142.  
  143. In Motif 1.0 call the undocumented _XmGrabTheFocus(target).
  144.  
  145. Do not use the X or Xt calls such as XtSetKeyboardFocus since this bypasses
  146. the Motif traversal layer and can cause it to get confused.  This can lead to
  147. odd keyboard behaviour elsewhere in your application.
  148.  
  149. -----------------------------------------------------------------------------
  150. Subject: 114)  How can I have a modal dialog which has to be answered before
  151. the application can continue?
  152.  
  153. [Last modified: Oct 94]
  154.  
  155. Answer: Note: J.-N. Meurisse (uunet!rc4.vub.ac.be!jnmeuris) sent a correction
  156. to the following code fragment. Change:
  157.  
  158.         XtAddCallback(dialog, XmNpopdownCallback, ...)
  159. to
  160.         XtAddCallback(XtParent(dialog), XmNpopdownCallback, ...)
  161.  
  162. The answer depends on whether you are using the Motif window manager mwm or
  163. not.  Test for this by XmIsMotifWMRunning.
  164.  
  165. The window manager mwm knows how to control event passing to dialog widgets
  166. declared as modal. If the dialog is set to application modal, then no
  167. interaction with the rest of the application can occur until the dialog is
  168. destroyed or unmanaged.
  169.  
  170. Use the appropriate code in the following program.  There is followup
  171. discussion after the program.
  172.  
  173.  
  174. /* Written by Dan Heller.  Copyright 1991, O'Reilly && Associates.
  175.  * This program is freely distributable without licensing fees and
  176.  * is provided without guarantee or warranty expressed or implied.
  177.  * This program is -not- in the public domain.  This program is
  178.  * taken from the Motif Programming Manual, O'Reilly Volume 6.
  179.  */
  180.  
  181. /*
  182.  * ask_user.c -- create a pushbutton that posts a dialog box
  183.  * that asks the user a question that requires an immediate
  184.  * response.  The function that asks the question actually
  185.  * posts the dialog that displays the question, waits for and
  186.  * returns the result.
  187.  */
  188. #include <X11/Intrinsic.h>
  189. #include <Xm/DialogS.h>
  190. #include <Xm/SelectioB.h>
  191. #include <Xm/RowColumn.h>
  192. #include <Xm/MessageB.h>
  193. #include <Xm/PushBG.h>
  194. #include <Xm/PushB.h>
  195.  
  196. XtAppContext app;
  197.  
  198. #define YES 1
  199. #define NO  2
  200.  
  201. /* main() --create a pushbutton whose callback pops up a dialog box */
  202. main(argc, argv)
  203. char *argv[];
  204. int argc;
  205. {
  206.     Widget parent, button, toplevel;
  207.     XmString label;
  208.     void pushed();
  209.  
  210.     toplevel = XtAppInitialize(&app, "Demos",
  211.         NULL, 0, &argc, argv, NULL, NULL, 0);
  212.  
  213.     label = XmStringCreateSimple("/bin/rm *");
  214.     button = XtVaCreateManagedWidget("button",
  215.         xmPushButtonWidgetClass, toplevel,
  216.         XmNlabelString,          label,
  217.         NULL);
  218.     XtAddCallback(button, XmNactivateCallback,
  219.         pushed, "Remove Everything?");
  220.     XmStringFree(label);
  221.  
  222.     XtRealizeWidget(toplevel);
  223.     XtAppMainLoop(app);
  224. }
  225.  
  226. /* pushed() --the callback routine for the main app's pushbutton. */
  227. void
  228. pushed(w, question)
  229. Widget w;
  230. char *question;
  231. {
  232.     if (AskUser(w, question) == YES)
  233.         puts("Yes");
  234.     else
  235.         puts("No");
  236. }
  237.  
  238. /*
  239.  * AskUser() -- a generalized routine that asks the user a question
  240.  * and returns the response.
  241.  */
  242. AskUser(parent, question)
  243. char *question;
  244. {
  245.     static Widget dialog;
  246.     XmString text, yes, no;
  247.     static int answer;
  248.     extern void response();
  249.  
  250.     answer = 0;
  251.     if (!dialog) {
  252.         dialog = XmCreateQuestionDialog(parent, "dialog", NULL, 0);
  253.         yes = XmStringCreateSimple("Yes");
  254.         no = XmStringCreateSimple("No");
  255.         XtVaSetValues(dialog,
  256.             XmNdialogStyle,        XmDIALOG_APPLICATION_MODAL,
  257.             XmNokLabelString,      yes,
  258.             XmNcancelLabelString,  no,
  259.             NULL);
  260.         XtSetSensitive(
  261.             XmMessageBoxGetChild(dialog, XmDIALOG_HELP_BUTTON), False);
  262.         XtAddCallback(dialog, XmNokCallback, response, &answer);
  263.         XtAddCallback(dialog, XmNcancelCallback, response, &answer);
  264.         /* if the user interacts via the system menu: */
  265. /* SEE CORRECTION ABOVE */
  266.         XtAddCallback(dialog, XmNpopdownCallback, response, &answer);
  267.     }
  268.     text = XmStringCreateSimple(question);
  269.     XtVaSetValues(dialog,
  270.         XmNmessageString,      text,
  271.         NULL);
  272.     XmStringFree(text);
  273.     XtManageChild(dialog);
  274.     XtPopup(XtParent(dialog), XtGrabNone);
  275.  
  276.     /* while the user hasn't provided an answer, simulate XtMainLoop.
  277.      * The answer changes as soon as the user selects one of the
  278.      * buttons and the callback routine changes its value.  Don't
  279.      * break loop until XtPending() also returns False to assure
  280.      * widget destruction.
  281.      */
  282.     while (answer == 0 || XtAppPending(app))
  283.         XtAppProcessEvent(app, XtIMAll);
  284.     return answer;
  285. }
  286.  
  287. /* response() --The user made some sort of response to the
  288.  * question posed in AskUser().  Set the answer (client_data)
  289.  * accordingly and destroy the dialog.
  290.  */
  291. void
  292. response(w, answer, reason)
  293. Widget w;
  294. int *answer;
  295. XmAnyCallbackStruct *reason;
  296. {
  297.     switch (reason->reason) {
  298.         case XmCR_OK:
  299.             *answer = YES;
  300.             break;
  301.         case XmCR_CANCEL:
  302.             *answer = NO;
  303.             break;
  304.         default:
  305.             *answer = NO;
  306.             return;
  307.     }
  308. }
  309.  
  310.  
  311. If you aren't running a window manager that acknowledges this hint, then you
  312. may have to grab the pointer (and keyboard) yourself to make sure the user
  313. doesn't interact with any other widget.  Change the grab flag in XtPopup to
  314. XtGrabExclusive, and XtRemoveGrab(XtParent(w)) to the response() function.
  315.  
  316.  
  317. -----------------------------------------------------------------------------
  318. Subject: 115)  TOPIC: MEMORY AND SPEED
  319.  
  320. -----------------------------------------------------------------------------
  321. Subject: 116)  When can I free data structures passed to or retrieved from
  322. Motif?
  323.  
  324. Answer:
  325.  In most cases, especially for XmStrings and XmFontLists, Motif copies data
  326. passed to it or retrieved from it, so it may be freed immediately.  Server-
  327. side resources, such as pixmaps and color cells, however, are not copied, so
  328. should not be freed.  More recent versions of Motif are better than earlier
  329. versions and exceptions should be documented.
  330.  
  331. Thanks to Ken Lee, kenton@allegro.esd.sgi.com
  332.  
  333. -----------------------------------------------------------------------------
  334. Subject: 117)  Why does my application grow in size?
  335.  
  336. Answer: Motif 1.0 has many memory leaks, particularly in XmString
  337. manipulation.  Switch to Motif 1.1.
  338.  
  339. Answer: The Intrinsics have a memory leak in accelerator table management, and
  340. Motif uses this heavily.  Avoid this by mapping/unmapping widgets rather than
  341. creating/destroying them, or get  X11R4 fix-15/16/17.
  342.  
  343. Answer: The server may grow in size due to its own memory leaks.  Switch to a
  344. later server.
  345.  
  346. Answer: You are responsible for garbage collection in `C'.  Some common cases
  347. where a piece of memory becomes garbage are
  348.  
  349.  a.  Memory is allocated by Motif for XmStrings by the functions
  350.      XmStringConcat, XmStringCopy, XmStringCreate, XmStringCreateLtoR,
  351.      XmStringCreateSimple, XmStringDirectionCreate, XmStringNConcat,
  352.      XmStringNCopy, XmStringSegmentCreate, and XmStringSeparatorCreate.  The
  353.      values returned by these functions should be freed using XmStringFree
  354.      when they are no longer needed.
  355.  
  356.  b.  Memory is allocated by Motif for ordinary character strings (of type
  357.      String) by Motif in XmStringGetLtoR, XmStringGetNextComponent, and
  358.      XmStringGetNextSegment. After using the string, XtFree() it. [Note that
  359.      XmStrings and Strings are two different data types.  XmStrings are
  360.      XmStringFree'd, Strings are XtFree'd.]
  361.  
  362.  c.  If you have set the label (an XmString) in a label, pushbutton, etc
  363.      widget, free it after calling XtSetValues() or the widget creation
  364.      routine by XmStringFree().
  365.  
  366.  d.  If you have set text in a text widget, the text widget makes its own
  367.      copy.  Unless you have a use for it, there is no need to keep your own
  368.      copy.
  369.  
  370.  e.  If you have set the strings in a list widget the list widget makes its
  371.      own copy.  Unless you have a use for it, there is no need to keep your
  372.      own copy.
  373.  
  374.  f.  When you get the value of a single compound string from a Widget e.g.
  375.      XmNlabelString, XmNmessageString, ... Motif gives you a copy of its
  376.      internal value.  You should XmStringFree this when you have finished with
  377.      it.
  378.  
  379.  g.  On the other hand, when you get a value of a Table e.g. XmStringTable for
  380.      a List, you get a *pointer* to the internal Table, and should not free
  381.      it.
  382.  
  383.  h.  When you get the value of the text in a widget by XmTextGetString or from
  384.      the resource XmNvalue, you get a copy of the text.  You should XtFree
  385.      this when you have finished with it.
  386.  
  387. Answer: From Josef Nelissen: at least in Motif 1.1.4, X11R4 on a HP 720, the
  388. XmText/XmTextFieldSetString() functions have a memory leak.  The old
  389. value/contents of the Widget isn't freed correctly.  To work around this bug,
  390. one should use a XmText Widget (in single-line-mode) instead of a XmTextField
  391. Widget (the solution fails with XmTextField Widgets !) and replace any
  392.  
  393.        XmTextSetString(text_widget, str);
  394.  
  395. by
  396.  
  397.        XmTextReplace(text_widget, (XmTextPosition) 0,
  398.                      XmTextGetLastPosition(text_widget), str);
  399.  
  400.  
  401. -----------------------------------------------------------------------------
  402. Subject: 118)  Why does my application take a long time to start up?
  403.  
  404. Answer: You are probably creating too many widgets at startup time.  Delay
  405. creating them until needed.  If you have a large number of resources in text
  406. files (such as in app-defaults), time may be spent reading and parsing it.
  407.  
  408. -----------------------------------------------------------------------------
  409. Subject: 119)  My application is running too slowly. How can I speed it up?
  410.  
  411. Answer: Use the R4 rather than R3 server.  It is much faster.
  412.  
  413. Answer: The standard memory allocator is not well tuned to Motif, and can
  414. degrade performance.  Use a better allocator.  e.g. with SCO Unix, link with
  415. libmalloc.a; use the allocator from GNU emacs; use the allocator from Perl.
  416.  
  417. Answer: Avoid lots of widget creation and destruction.  It fragments memory
  418. and slows everything down.  Popup/popdown, manage/unmanage instead.
  419.  
  420. Answer: Set mappedWhenManaged to FALSE, and then call XtMapWidget()
  421. XtUnmapWidget() rather than managing.
  422.  
  423. Answer: Get more memory - your application, the server and the Operating
  424. System may be spending a lot of time being swapped.
  425.  
  426. Answer: If you are doing much XmString work yourself, such as heavy use of
  427. XmStringCompare, speed may deteriorate due to the large amount of internal
  428. conversions and malloc'ing.  Try using XmStringByteCompare if appropriate or
  429. ordinary Ascii strings if you can.
  430.  
  431.  
  432. -----------------------------------------------------------------------------
  433. Subject: 120)  Why is my application so huge?
  434.  
  435. Answer: The typical size of a statically linked Motif app is in the megabytes.
  436. This is often caused by the size of libXm.a. A large part of this gets linked
  437. in to even trivial Motif programs. You can reduce the code size by linking
  438. against shared libraries if they are available.  Running "strip" on the
  439. executable can often reduce size. Note that the size of the running program
  440. should be measured by "ps", not by the code size.
  441.  
  442. -----------------------------------------------------------------------------
  443. Subject: 121)  TOPIC: XMSTRING
  444.  
  445. -----------------------------------------------------------------------------
  446. Subject: 122)  What string functions differ in Motif 1.2?
  447.  
  448. Answer: Matthew B. Evans (Evans@EDFUA6.ctis.af.mil) writes:
  449.  
  450. We just upgraded from Motif 1.1 to 1.2.  When we went to compile, no problem,
  451. but our XmStringCreateSimple() and XmStringGetLtoR() seemed to have problems.
  452.  
  453. As we found out, Motif 1.2 STRONGLY recommends to use the constant
  454. XmDEFAULT_FONTLIST_TAG instead of XmSTRING_DEFAULT_CHARSET in all of the
  455. XmStringXXX() functions, as XmSTRING_DEFAULT_CHARSET is maintained only for
  456. compatibility (not a whole lot in my opinion).  I got this information from
  457. Book 6B from O'Reilly.
  458.  
  459. You may want to take a look at this book if you can, and possibly update
  460. several of the Motif FAQs on XmStrings.  Some XmString functions are outdated
  461. and maintained only for compatibility, whereas some don't function correctly
  462. when using XmSTRING_DEFAULT_CHARSET (from our in-depth tests).
  463.  
  464. We have changed all our XmStringCreateSimple() to XmStringCreateLocalized()
  465. (as suggested in book 6B) and changed all XmSTRING_DEFAULT_CHARSET to
  466. XmDEFAULT_FONTLIST_TAG.
  467.  
  468. [TBD next month: I have not updated the following string questions based on
  469. the above...ksall@cen.com.]
  470.  
  471. -----------------------------------------------------------------------------
  472. Subject: 123)  How can I get the Ascii text out of an XmString?
  473.  
  474. Answer: To get the first line of text from a string created left-to-right
  475.  
  476.  
  477.         char *str;
  478.         XmString xmstr;
  479.  
  480.         /* stuff to create xmstr */
  481.         ...
  482.  
  483.         /* set str to point to the text */
  484.         XmStringGetLtoR(xmstr, XmSTRING_DEFAULT_CHARSET, &str);
  485.         /* use the string */
  486.         ...
  487.  
  488.         /* and reclaim space */
  489.         XtFree(str);
  490.  
  491.  
  492. -----------------------------------------------------------------------------
  493. Subject: 124)  When can XmStrings used as resources be freed?
  494.  
  495. Answer: The policy OSF have been trying to enforce is that if you set an
  496. XmString or XmStringTable resource, the application is responsible for freeing
  497. the XmStrings used because the widget makes a copy.  If you get an XmString
  498. resource, then the application must free the value gotten.  If you get an
  499. XmStringTable, then the application should NOT free the value gotten.  If the
  500. application wants to manipulate it, it should make a copy first. This policy
  501. appears to be implemented progressively, so may be less true for Motif 1.0
  502. than 1.1.
  503.  
  504. -----------------------------------------------------------------------------
  505. Subject: 125)  Why doesn't XmStringGetNextSegment() work properly?
  506.  
  507. Answer: The documentation in Motif 1.0 is in error. Instead of
  508.  
  509.         XmStringGetnextSegment(context, ...)
  510.         XmStringContext * context;
  511.  
  512. it should be
  513.  
  514.         XmStringGetnextSegment(context, ...)
  515.         XmStringContext context;
  516.  
  517. i.e. with no indirection.
  518.  
  519.  
  520. -----------------------------------------------------------------------------
  521. Subject: 126)  Why does using XmStringDraw cause a Bad Font error?
  522.  
  523. [Last modified: Sept 94]
  524.  
  525. Answer: From Thomas Berlage (berlage@gmdzi.gmd.de): You could call this a bug
  526. in Motif. You pass a GC to XmStringDraw, however, Motif wants to use the fonts
  527. from the font list to draw the string.  Therefore it replaces the font of the
  528. GC temporarily with some fonts of its own as specified in the font list. In
  529. the end it tries to restore the old font of the GC. There comes the problem:
  530.  
  531. If a GC uses the default font, the client side GC structure does not have a
  532. valid font id (that is the 0xffffffff you may see in the error message). Motif
  533. tries to restore this invalid id at the end.
  534.  
  535. The workaround is: Before drawing with XmStringDraw, set the font id of the GC
  536. to any valid font id, for example using
  537.  
  538.       XSetFont (display, gc, XLoadFont (display, "fixed"));
  539.  
  540. Another solution is available from "Harry's Motif Programming Corner", Harald
  541. Albrecht, albrecht@igpm.rwth-aachen.de, who writes:
  542.  
  543. "It's somewhat longer but doesn't rely on a font named "fixed" installed on
  544. your platform. Instead it takes a fontlist and then uses the first font listed
  545. there. You'll find this source together with a short demo program (which
  546. creates a DrawingArea and then paints some text in it) on:
  547.   ftp.igpm.rwth-aachen.de (134.130.161.30)
  548.   in: /arc/pub/unix/motif/RenderXmString.tar.gz
  549.  
  550. There's also a html page available:
  551.   file://ftp.igpm.rwth-aachen.de/arc/pub/unix/html/renderxmstrings.html "
  552.  
  553. From Harald Albrecht (albrecht@igpm.rwth-aachen.de)
  554.  
  555. -----------------------------------------------------------------------------
  556. Subject: 127)  TOPIC: DIALOGS
  557.  
  558. -----------------------------------------------------------------------------
  559. Subject: 128)  How do I stop my dialog disappearing when I press the help
  560. button?
  561.  
  562. Answer: Bulletin board has the resource autoUnmanage which defaults to True.
  563. This unmanages the widget when any button child is activated - including the
  564. help button.  Set this to False to stop it disappearing. Note that you then
  565. have to unmanage the bulletin board yourself when any other button is
  566. activated.
  567.  
  568. -----------------------------------------------------------------------------
  569. Subject: 129)  How do I make my own dialog?  I want a dialog with my own set
  570. of buttons that stretch and shrink like the ones in e.g. PromptDialog and its
  571. own contents.
  572.  
  573. Answer: Start off with say a PromptDialog. Unmanage the buttons you don't want
  574. or manage the Apply button if you want another. Unmanage the other bits of the
  575. selection box you don't want. You can add another WorkArea child to the
  576. selection box for any extra stuff you want.
  577.  
  578.     /* Copyright 1990, Kee Hinckley and Brian Holt Hawthorne */
  579.     /* Permission granted for any use, provided this copyright */
  580.     /* notice is maintained. */
  581.  
  582.     /* Create a dialog box */
  583.     argcount = setArgs(&args, XmNautoUnmanage, False, NULL);
  584.     SomeDialog = XmCreatePromptDialog(mainShell, "someDialog", args, argcount);
  585.  
  586.     /* Now get rid of the things we don't want */
  587.     child = XmSelectionBoxGetChild(SomeDialog, XmDIALOG_SELECTION_LABEL);
  588.     XtUnmanageChild(child);
  589.     child = XmSelectionBoxGetChild(SomeDialog, XmDIALOG_TEXT);
  590.     XtUnmanageChild(child);
  591.  
  592.     /* set the callbacks, and make sure the buttons we want are there */
  593.     child = XmSelectionBoxGetChild(SomeDialog, XmDIALOG_OK_BUTTON);
  594.     XtAddCallback(child, XmNactivateCallback, callSomeFunc, someArg);
  595.     XtAddCallback(child, XmNactivateCallback, unManage, SomeDialog);
  596.     XtManageChild(child);
  597.     child = XmSelectionBoxGetChild(SomeDialog, XmDIALOG_APPLY_BUTTON);
  598.     XtAddCallback(child, XmNactivateCallback, callSomeFunc, someOtherArg);
  599.     XtManageChild(child);
  600.     child = XmSelectionBoxGetChild(SomeDialog, XmDIALOG_CANCEL_BUTTON);
  601.     XtAddCallback(child, XmNactivateCallback, dialogUnmanage, SomeDialog);
  602.     XtManageChild(child);
  603.  
  604.     /* Add a new work area. This can be any manager. */
  605.     child = XmCreateForm(SomeDialog, "someForm", NULL, 0);
  606.     XtManageChild(child);
  607.  
  608.     /* and fill it up... */
  609.     something = doYourStuff(child);
  610.  
  611. another Answer:
  612.  
  613.         I had a some people asking about my xmSmartMessageBoxWidget
  614.  
  615.         It's public domain, and needs Motif-1.2  and is available at
  616.         ftp.x.org:/contrib/widget/SmartMB.tar.Z.
  617.  
  618.         The basic idea behind it is that it allows the programmer to
  619.         specify the management of child widgets in 4 areas: Label, Control,
  620.         Separator and Action.  You can have up to 1 Label, 1 Control,
  621.         1 Separator and as many Action children as you want.  It does not
  622.         REQUIRE any of these, and there is no unmanaging of extra widgets,
  623.         as the programmer creates what is needed.
  624.  
  625.         Thanks for the smart dialog info to:         John L. Cwikla
  626.         Wolfram Research, Inc.          cwikla@wri.com
  627.  
  628.  
  629. -----------------------------------------------------------------------------
  630. Subject: 130)  Why do dialog title bars have "_popup" or "<-popup"
  631. concatenated onto the widget name?
  632.  
  633.  
  634. Answer: Motif 1.0.3 (?) "fixed" things such that title bars without an
  635. explicit dialogTitle setting use the widget name with "_popup" or whatever
  636. added on.  Set the dialogTitle resource explicitly if you don't want this new
  637. default naming scheme.
  638.  
  639. -----------------------------------------------------------------------------
  640. Subject: 131)  How can I force a dialog window to display?  I manage a
  641. "working" dialog, and do some computing, but the dialog window appears blank
  642. until the work has finished.  How can I force it to be displayed?
  643.  
  644. Answer: Use this.  (David Brooks, Systems Engineering, Open Software
  645. Foundation)
  646.  
  647. /*
  648.  * This procedure will ensure that, if a dialog window is being mapped,
  649.  * its contents become visible before returning.  It is intended to be
  650.  * used just before a bout of computing that doesn't service the display.
  651.  * You should still call XmUpdateDisplay() at intervals during this
  652.  * computing if possible.
  653.  *
  654.  * The monitoring of window states is necessary because attempts to map
  655.  * the dialog are redirected to the window manager (if there is one) and
  656.  * this introduces a significant delay before the window is actually mapped
  657.  * and exposed.  This code works under mwm, twm, uwm, and no-wm.  It
  658.  * doesn't work (but doesn't hang) with olwm if the mainwindow is iconified.
  659.  *
  660.  * The argument to ForceDialog is any widget in the dialog (often it
  661.  * will be the BulletinBoard child of a DialogShell).
  662.  */
  663.  
  664. ForceDialog(w)
  665.      Widget w;
  666. {
  667.   Widget diashell, topshell;
  668.   Window diawindow, topwindow;
  669.   Display *dpy;
  670.   XWindowAttributes xwa;
  671.   XEvent event;
  672.   XtAppContext cxt;
  673.  
  674. /* Locate the shell we are interested in.  In a particular instance, you
  675.  * may know these shells already.
  676.  */
  677.  
  678.   for (diashell = w;
  679.        !XtIsShell(diashell);
  680.        diashell = XtParent(diashell))
  681.     ;
  682.  
  683. /* Locate its primary window's shell (which may be the same) */
  684.  
  685.   for (topshell = diashell;
  686.        !XtIsTopLevelShell(topshell);
  687.        topshell = XtParent(topshell))
  688.     ;
  689.  
  690.   if (XtIsRealized(diashell) && XtIsRealized(topshell)) {
  691.     dpy = XtDisplay(topshell);
  692.     diawindow = XtWindow(diashell);
  693.     topwindow = XtWindow(topshell);
  694.     cxt = XtWidgetToApplicationContext(diashell);
  695.  
  696. /* Wait for the dialog to be mapped.  It's guaranteed to become so unless... */
  697.  
  698.     while (XGetWindowAttributes(dpy, diawindow, &xwa),
  699.            xwa.map_state != IsViewable) {
  700.  
  701. /* ...if the primary is (or becomes) unviewable or unmapped, it's
  702.    probably iconified, and nothing will happen. */
  703.  
  704.       if (XGetWindowAttributes(dpy, topwindow, &xwa),
  705.           xwa.map_state != IsViewable)
  706.         break;
  707.  
  708. /* At this stage, we are guaranteed there will be an event of some kind.
  709.    Beware; we are presumably in a callback, so this can recurse. */
  710.  
  711.       XtAppNextEvent(cxt, &event);
  712.       XtDispatchEvent(&event);
  713.     }
  714.   }
  715.  
  716. /* The next XSync() will get an expose event if the dialog was unmapped. */
  717.  
  718.   XmUpdateDisplay(topshell);
  719. }
  720.  
  721.  
  722. -----------------------------------------------------------------------------
  723. Subject: 132)  How can I control placement of a popup widget?  Each time a
  724. popup is created, it is placed in or over the middle of its parent.  How can I
  725. make it obey the XmNx and XmNy values?
  726.  
  727. Answer: Set the resource XmNdefaultPosition for the popup to False.  Set the
  728. position of the popup by the resource values of XmNx and XmNy.  Do not use
  729. XtMoveWidget, as this is for widget writers only.  Here's a demo program from
  730. Dan Heller:
  731.  
  732. /* Written by Dan Heller.  Copyright 1991, O'Reilly && Associates.
  733.  * This program is freely distributable without licensing fees and
  734.  * is provided without guarantee or warranty expressed or implied.
  735.  * This program is -not- in the public domain.  This program is
  736.  * taken from the Motif Programming Manual, O'Reilly Volume 6.
  737.  */
  738.  
  739. /* map_dlg.c -- Use the XmNmapCallback to automatically position
  740.  * a dialog on the screen.  Each time the dialog is displayed, it
  741.  * is mapped down and to the right by 200 pixels in each direction.
  742.  */
  743. #include <Xm/MessageB.h>
  744. #include <Xm/PushB.h>
  745.  
  746. /* main() --create a pushbutton whose callback pops up a dialog box */
  747. main(argc, argv)
  748. char *argv[];
  749. {
  750.     Widget toplevel, button;
  751.     XtAppContext app;
  752.     void pushed();
  753.  
  754.     toplevel = XtVaAppInitialize(&app, "Demos",
  755.         NULL, 0, &argc, argv, NULL, NULL);
  756.  
  757.     button = XtCreateManagedWidget("button", xmPushButtonWidgetClass,
  758.         toplevel, NULL, 0);
  759.     XtAddCallback(button, XmNactivateCallback, pushed, "Hello World");
  760.  
  761.     XtRealizeWidget(toplevel);
  762.     XtAppMainLoop(app);
  763. }
  764.  
  765. /* callback function for XmNmapCallback.  Position dialog in 200 pixel
  766.  * "steps".  When the edge of the screen is hit, start over.
  767.  */
  768. static void
  769. map_dialog(dialog, client_data, cbs)
  770. Widget dialog;
  771. XtPointer client_data;
  772. XmAnyCallbackStruct *cbs;
  773. {
  774.     static Position x, y;
  775.     Dimension w, h;
  776.  
  777.     XtVaGetValues(dialog, XmNwidth, &w, XmNheight, &h, NULL);
  778.     if ((x + w) >= WidthOfScreen(XtScreen(dialog)))
  779.         x = 0;
  780.     if ((y + h) >= HeightOfScreen(XtScreen(dialog)))
  781.         y = 0;
  782.     XtVaSetValues(dialog, XmNx, x, XmNy, y, NULL);
  783.     x += 200, y += 200;
  784. }
  785.  
  786. /* pushed() --the callback routine for the main app's pushbutton.
  787.  * Create and popup a dialog box that has callback functions for
  788.  * the Ok, Cancel and Help buttons.
  789.  */
  790. void
  791. pushed(w, message)
  792. Widget w;
  793. char *message; /* The client_data parameter passed by XtAddCallback */
  794. {
  795.     Widget dialog;
  796.     Arg arg[3];
  797.     XmString t = XmStringCreateSimple(message);
  798.     extern void response();
  799.  
  800.     XtSetArg(arg[0], XmNautoUnmanage, False);
  801.     XtSetArg(arg[1], XmNmessageString, t);
  802.     XtSetArg(arg[2], XmNdefaultPosition, False);
  803.     dialog = XmCreateMessageDialog(w, "notice", arg, 3);
  804.     XmStringFree(t);
  805.  
  806.     XtAddCallback(dialog, XmNmapCallback, map_dialog, NULL);
  807.  
  808.     XtManageChild(dialog);
  809.     XtPopup(XtParent(dialog), XtGrabNone);
  810. }
  811.  
  812.  
  813. -----------------------------------------------------------------------------
  814. Subject: 133)  TOPIC: LANGUAGE BINDINGS
  815.  
  816. -----------------------------------------------------------------------------
  817. Subject: 134)* Is there a C++ binding for Motif?
  818.  
  819. [Last modified: Oct 94]
  820.  
  821.  
  822. Answer: WWL is a library which defines C++ classes around X Toolkit Widgets.
  823. It is intended to simplify the task of C++ code writers when using the Toolkit
  824. by providing them with C++ objects, methods, type checking and several utility
  825. functions and classes.
  826.  
  827. WWL has been tested under SunOs4.0.3 on sun3 and sun4, HPUX version 6.5 and
  828. 7.0 and Ultrix 4.0 on DECstation 3100 and 5000. It is expected to work on most
  829. other UNIX systems without too many problems.
  830.  
  831. WWL is distributed as a tar file with all the source, documentation and
  832. example. The file is available using anonymous ftp from
  833.  
  834.         ftp.x.org            /R5contrib/WWW-1.2.tar.Z
  835.  
  836. ( ftp://ftp.x.org/R5contrib/WWW-1.2.tar.Z )
  837.  
  838. Answer: Rogue Wave Software has a C++ binding for Motif called View.h++.
  839.  
  840. "View.h++ is a complete C++ interface to OSF/Motif.  It doesn't just
  841. encapsulate it, but also includes a set of classes that provide a level of
  842. abstraction above Motif, thus simplifying menu and dialog creation, XmStrings,
  843. XmFontLists, etc.  View.h++ supports a Model- View-Controller architecture,
  844. allowing for an even more object-oriented interface design.  Includes a copy
  845. of Rogue Wave's Tools.h++ (foundation class library)"
  846.  
  847. An object license is $795 "per seat" and a source code license is available
  848. for $2,995 "per seat."  Rogue Wave also offers full support for View.h++.
  849.  
  850. It is currently available for Sun Sparc, IBM RS/6000, HP 9000/700 series, SCO,
  851. Intel SVR4 ESIX.  Please call for Silicon Graphics and DEC Ultrix status.
  852.  
  853. For additional information, please contact:
  854.  
  855. Matt Steinauer
  856. Rogue Wave Software, Inc.
  857. P.O. Box 2328
  858. Corvallis, OR 97339
  859. Phone: (503)754-3010
  860. Fax:   (503)757-6650
  861.  
  862. email:   matts@roguewave.com
  863.  
  864.  
  865. Answer: Builder Xcessory 3.0, an interface builder from ICS, allows the user
  866. to visually build C++ classes from Motif and user-written widgets.  C++ code
  867. is generated in the "Doug Young" fashion.  (Doug actually worked on this
  868. project with ICS.)  C and UIL can also be generated.
  869.  
  870. Integrated Computer Solutions, Inc. (ICS) 201 Broadway, Cambridge, MA  02139
  871. USA info@ics.com   617/621-0060
  872.  
  873.  
  874. Answer: From Andreas.Baecker@gmd.de: The GINA++ application framework contains
  875. an encapsulation of the OSF/Motif widg et classes and the Xt functionality
  876. into C++ classes. Its functionality is comparab le to that of the ULowell
  877. binding and the WWL. Additionally, it provides an easy-to -use framework for
  878. modeling new composite and primitive widget classes, plus an application
  879. framework similar to ET++ or MacApp build on top of it. The binding may be
  880. used independently from the framework classes. GINA++ is available through
  881. anonymous ftp from ftp.gmd.de [129.26.8.90] in the directory /gmd/ginaplus.
  882. Documentation about the Motif binding has been published in the X Resource
  883. Journ al, Number 2, 1992, Pages 106-130. The binding compiles with AT&T C++
  884. 2.1 and GNU G+ + 2.1 and has been tested on SunOS 4.1.[12], X11R4 and Motif
  885. 1.1.3.
  886.  
  887. Answer: Motif++ is a library that defines C++ class "wrappers" for the widgets
  888. defined in the X11R5 OSF/Motif-1.2 widget library.  It also supports
  889. X11R4/Motif-1.1 as well.
  890.  
  891. Motif++ is also an application toolkit that provides other tools in
  892. conjunction with the widget wrapper classes.  It has support for the Xbae
  893. widget set, plus other widgets.  It has Imake support, and lots of test files.
  894. Motif++ also has alot of contributed software.
  895.  
  896.  
  897. Motif++ is very similar to other public domain widget libraries such as The
  898. Widget Wrapper Library (WWL) and the C++ Binding for OSF/Motif developed at
  899. the University of Lowell. The two latter libraries are the result of much
  900. larger efforts.
  901.  
  902. Available via anonymous ftp:
  903.  
  904.         ftp://src.doc.ic.ac.uk/packages/motif++/motif++.30.jul.94.tar.gz
  905.  
  906. The /packages/motif++ also contains documentation.  For more information,
  907. contact Ronald van Loon (rvloon@motif.xs4all.nl).  There is also mailing list
  908. for Motif++:
  909.  
  910.         motif++@motif.xs4all.nl
  911.  
  912. To join, send email to the administrative address:
  913.  
  914.         motif++-request@motif.xs4all.nl
  915.  
  916. C++ Report, a magazine published by SIGS Publications, now regularly publishes
  917. articles on X, Xt and Motif vs. C++ written by Ronald van Loon.
  918.  
  919. Answer: Xm++ is a user interface framework for the C++ language built upon X11
  920. and the X-Toolkit. It is designed to be a simple and intuitive programming
  921. interface to access the functionality of commonly used widgets.  Xm++ was
  922. initially created for the Motif widget set, now support for the Athena widgets
  923. was added. Applications created with Xm++ run in both environments without
  924. changes, although many nice features are only available when using Motif.
  925.  
  926. Xm++ is available on: ftp.x.org as: /R5contrib/Xm++.0.53.tar.Z (
  927. ftp://ftp.x.org/R5contrib/Xm++.0.53.tar.Z ).
  928.  
  929. Answer: wxWindows is a toolkit for platform-independent GUI programming in
  930. C++. It consists of several class libraries and tools.  wxWindows has been
  931. made freely available with no commercial restrictions. As well as undergoing
  932. further development at AIAI ( http://www.aiai.ed.ac.uk/ ), outside
  933. contributors are helping to extend its abilities and range of platforms.  See
  934. http://www.aiai.ed.ac.uk/~jacs/wxwin.html .
  935.  
  936. Answer: The Solbourne OI toolkit (not Motif) also has a C++ binding.
  937.  
  938. Answer: Liant have C++/Views.
  939.  
  940. Answer: Quest have ObjectViews.  Answer: Builder Xcessory 3.0, an interface
  941. builder from ICS, allows the user to visually build C++ classes from Motif and
  942. user-written widgets.  C++ code is generated in the "Doug Young" fashion.
  943. (Doug actually worked on this project with ICS.)  C and UIL can also be
  944. generated.
  945.  
  946. Integrated Computer Solutions, Inc. (ICS) 201 Broadway, Cambridge, MA  02139
  947. USA info@ics.com   617/621-0060
  948.  
  949.  
  950. Answer: Doug Young has written a book "Object Oriented Programming with C++
  951. and Motif", Prentice-Hall ISBN 0-13-630252-1 about using C++ without requiring
  952. one of these toolkits.
  953.  
  954. Answer: Unfortunately, this library (last released in 9/92) has the same name
  955. as the one by Ronald van Loon (rvloon@motif.hacktic.nl).  Motif++1.2 is a
  956. library that defines C++ class "wrappers" for the widgets defined in the
  957. OSF/Motif-1.1 widget library.  Motif++1.2 is also an application toolkit that
  958. provides other tools in conjunction with the widget wrapper classes.
  959.     One enhancement of Motif++1.2 beyond its wrapper classes are the addition
  960. of an "application" class which takes care of the low-level tasks including
  961. initializing X, creating and managing one or more top-level shells, and
  962. entering the main event loop.
  963.     Another feature of Motif++1.2 is its integration with The Widget Creation
  964. Library (Wcl).  Motif++1.2 makes it easy to initialize Wcl and create C++
  965. wrappers for desired widgets in the widget tree.
  966.     Availability: anonymous FTP at ftp.arc.umn.edu (137.66.130.11), file
  967. pub/Motif++1.2.tar.Z.  Contact Paul Felix, felix@ahpcrc.umn.edu or
  968. pfelix@vx.cis.umn.edu.
  969.  
  970. submitted by: mvc!biggers@duke.cs.duke.edu ( Mark R. Biggers )
  971.  
  972. -----------------------------------------------------------------------------
  973. Subject: 135)+ How can I avoid C++ String class and typedef char *String
  974. conflicts ?  We're using the USL C++ Standard Components which has the String
  975. class.  This, however, conflicts with the typedef char *String found in
  976. <X11/Intrinsic.h>
  977.  
  978. [Last modified: Oct 94]
  979.  
  980. Answer: This is very simple to workaround.  I agree that it is "wrong" but all
  981. you need to do is:
  982.  
  983. #define String XtStringType
  984. #include "all the X files"
  985. #undef String
  986.  
  987.  
  988. This will translate the offending symbol.
  989.  
  990. Thanks to Doug Rand <drand@x.org>
  991.  
  992. -----------------------------------------------------------------------------
  993. Subject: 136)* How can I have a C++ member function in a callback?
  994.  
  995. [Last modified: Oct 94]
  996.  
  997. Answer: There are three common user problems with C++ callbacks.  First, make
  998. sure you use the correct function prototype for the function declarations.
  999. Second, the callback function must be declared as a static member of the
  1000. class.  Third, when registering it with XtAddCallback(), you must use its full
  1001. signature.  For example: (from Ken Lee, kenton@allegro.esd.sgi.com)
  1002.  
  1003.  
  1004.     class MyClass {
  1005.         ...
  1006.         void createWidgets();
  1007.         static void myButtonCB(Widget, XtPointer, XtPointer);
  1008.         ...
  1009.     };
  1010.     void MyClass::createWidgets() {
  1011.         ...
  1012.         w = XtCreatePushButton(...);
  1013.         XtAddCallback(w, XmNactivateCallback, &MyClass::myButtonCB,
  1014.             (XtPointer) this);
  1015.         ...
  1016.     }
  1017.     void myButtonCB(Widget w, XtPointer clientData, XtPointer callData) {
  1018.         MyClass *myclass = (MyClass *) clientData;
  1019.         ...
  1020.     }
  1021.  
  1022. Note that the "this" pointer is used as the client data.  This technique is
  1023. popular, but not required.
  1024.  
  1025.  
  1026. Motif++ has a nice tutorial summarizing mechanisms (Ronald van Loon,
  1027. rvloon@motif.xs4all.nl).  See his articles in the September, 1994 and
  1028. Nov/December, 1994 issues of C++ Report.
  1029.  
  1030. Doug Young's book deals extensively with one of these. The problem is that you
  1031. don't get the object when you just use the function as a callback.  You need
  1032. to pass the object as a pointer through as the client_data.  (use "this" as
  1033. the client_data.) Then you can retrieve the object's address, and dereference
  1034. from there. For example (Leo O'Donnell, Email: leo@avs.com),
  1035.  
  1036.  
  1037.     class MyButton {
  1038.       public:
  1039.                 MyButton (Widget parent, const char *name) {
  1040.                     _button = XtVaCreateManagedWidget (
  1041.                         name, xmPushButtonWidgetClass, parent, NULL, 0);
  1042.                     XtAddCallback (
  1043.                         _button,
  1044.                         XmNactivateCallback,
  1045.                         &MyButton::activateCB,
  1046.                         (XtPointer) this);
  1047.                 }
  1048.                 ~MyButton () { XtDestroyWidget (_button); }
  1049.       private:
  1050.         Widget  _button;
  1051.         static  void activateCB (Widget, XtPointer, XtPointer);
  1052.     };
  1053.  
  1054.     void MyButton::activateCB (Widget, XtPointer thisBtn, XtPointer)
  1055.     {
  1056.         MyButton *btn = (MyButton *) thisBtn;
  1057.  
  1058.         // OK you've got the button instance now. Do some stuff with it!
  1059.     }
  1060.  
  1061.  
  1062. -----------------------------------------------------------------------------
  1063. Subject: 137)* Is there a Common Lisp binding for Motif?
  1064.  
  1065. [Last modified: Oct 94]
  1066.  
  1067. Answer: Try CLM. This includes a toolkit demon (in C) that takes a widget
  1068. description (with callbacks), and forks a new process for each Motif
  1069. application (which can be just a single menu, or whatever).  Lisp can then
  1070. continue running, with a separate lightweight lisp process handling the
  1071. connection & callbacks.  In North America & net environs, CLM-2.3.tar.Z is
  1072. available from ftp.x.org.
  1073.  
  1074. There is also CLIM, the Common Lisp Interface Manager. It provides access to
  1075. motif and other toolkits and window systems.  Here is some blurb: "Version 2.0
  1076. of the Common Lisp Interface Manager (CLIM) provides access to Motif. CLIM is
  1077. the emerging standard for GUI development in Common Lisp.  It offers a set of
  1078. high-level facilities that enable rapid construction of user interfaces.
  1079. Applications written using CLIM are portable across a variety of window
  1080. systems and toolkits.  For example, on the X window System, both Motif
  1081. (OSF/Motif) and Openlook (OLIT) are supported.  CLIM accesses the toolkit
  1082. directly rather than emulating the look and feel."
  1083.  
  1084. CLIM is available from a variety of Common Lisp vendors including Symbolics
  1085. and Franz Inc. (info@franz.com).
  1086.  
  1087. -----------------------------------------------------------------------------
  1088. Subject: 138)  Is there an Ada binding for Motif?
  1089.  
  1090. [Last modified: Apr 94 ]
  1091.  
  1092. Answer:
  1093.  
  1094. Answer:  Integrated Computer Solutions, Inc. (ICS) supplies Ada bindings to
  1095. Motif for a number of platforms and Ada compilers.  ICS also provides Builder
  1096. Xcessory, a Motif interface builder, which outputs Ada code usable with the
  1097. Ada bindings.  The product family is known collectively as the Ada Xcessories.
  1098.  
  1099. Integrated Computer Solutions, Inc. (ICS) 201 Broadway, Cambridge, MA  02139
  1100. USA info@ics.com   617/621-0060
  1101.  
  1102.  
  1103. Information on Ada bindings to Motif and other services (such as SQL and
  1104. POSIX) can be found in a document maintained by the Ada Information
  1105. Clearinghouse.  The report can be found at
  1106.  
  1107.         host:   ajpo.sei.cmu.edu
  1108.         loc:    /public/ada-info/bindings.hlp.*
  1109.         access: anonymous ftp
  1110.  
  1111. The suffix to the file (indicated above with an asterix) is the date of the
  1112. latest update to the document.  For example, the full name of the report
  1113. updated on 14 June 1993 would be
  1114.  
  1115.         /public/ada-info/bindings.hlp.14Jun93.
  1116.  
  1117. The file is ASCII.
  1118.  
  1119. ------ Included File
  1120.  
  1121.  
  1122. [...Excerpted from the AdaIC report bindings.hlp.14Jun93...]
  1123. [...Updates can be found on ajpo.sei.cmu.edu, in the    ...]
  1124. [...file /public/ada-info/bindings.hlp.*  The suffix    ...]
  1125. [...is always the date of the lastest version to the    ...]
  1126. [...report.                                             ...]
  1127.  
  1128.                                      SECTION 12
  1129.                                   X-Window System:
  1130.                                OSF Motif and Open Look
  1131.                                Available Ada Bindings
  1132.  
  1133.  
  1134. 12.1  Description and Standardization Efforts
  1135.  
  1136. The X-Window System is a network-transparent window system.  It supports one
  1137. or more screens containing overlapping windows or subwindows.  X display
  1138. servers distribute user input to and accept output requests from various
  1139. client programs located either on the same machine or elsewhere in the
  1140. network.
  1141.  
  1142.             OSF Motif (Open Software Foundation/Motif) is a graphical user
  1143.             interface from OSF that provides a Presentation Manager look and
  1144.             feel for applications running on any system with X Window version
  1145.             11.  It conforms to POSIX, ANSI C and X/Open's XPG3 standards.
  1146.  
  1147. 12.2  Resources Available from Software Reuse Libraries/Repositories
  1148.  
  1149.  
  1150. ASSET                                                      (Updated:  November
  1151. 1 992)
  1152.  
  1153. The following information was taken in its entirety from the ASSET Library
  1154. Repository Catalog, October 9, 1992.  For more information on ASSET, see
  1155. Appendix C.
  1156.  
  1157.  
  1158. INTERFACE TO THE X WINDOW SYSTEM
  1159.  
  1160. VERSION_NUMBER    : 1.1
  1161. DEVELOPED_BY      : SAIC
  1162. RELEASE_DATE      : 29-SEP-88
  1163. UNIQUE_IDENTIFIER : ASSET_A_240
  1164. ALTERNATE_NAME    : SAICX2
  1165. ASSET_TYPE        : SOFTWARE CODE
  1166. FUNCTIONS         : INTERFACE, BIND
  1167. OBJECTS           : ADA, X WINDOWS
  1168. KEYWORDS          : STANDARDS, BINDINGS
  1169. COLLECTION        : STARS FOUNDATIONS
  1170. DISTRIBUTION      : UNLIMITED
  1171.  
  1172. DESCRIPTION       :
  1173.  
  1174. Interface to the X Window System
  1175.       An expression of the various concepts in Ada that provides a full,
  1176. working Ada specification of the X Window system.
  1177.      Approved for public release; distribution is unlimited.
  1178.  
  1179. 12.3  Products Available from Vendors
  1180.  
  1181.  
  1182. Advanced Technology Center                                 (Updated:  November
  1183. 1 992)
  1184.  
  1185. The Advanced Technology Center (ATC) has an Ada binding to OSF Motif for their
  1186. AXI~ product.  AXI is currently available for most UNIX-based platforms, and
  1187. is supported by Verdix, Meridian, and TeleSoft compilers.
  1188.  
  1189. AXI is an Ada-to-X-Window System interface that provides the Ada programmer
  1190. access to the 500+ functions, libraries, and procedures contained in the X
  1191. library (Xlib), the X Toolkit (Xt), the X Extensible Library, the X
  1192. Miscellaneous Utilities, the Motif widget set and the Motif Resource Manager.
  1193.  
  1194. ATC is planning to develop an Ada binding to Open Look for AXI.
  1195.  
  1196. For more information, contact:Larry Paulson, Advanced Technology Center, 22982
  1197.                         Mill Creek Drive, Laguna Hills, CA  92653, USA; Phone:
  1198.                         714-583-9119
  1199.  
  1200.  
  1201. Alsys, Inc.                                                     (Updated:  May
  1202. 1 992)
  1203.  
  1204. The Alsys Ada Software Development Environment (Alsys's validated Ada compiler
  1205. #901221W1.11103) for 386 UNIX is a production-quality Ada environment capable
  1206. of handling very large Ada applications (over 500,000 lines of code).  The
  1207. product includes the Compiler; Multi-Library Environment, which provides a
  1208. powerful and flexible way to manage Ada development effort and share program
  1209. units; Binder, which supports unused subprograms elimination; High-and Low-
  1210. Level Optimizers for improving code quality and performance; and Run-Time
  1211. Executive for efficient support for executing Ada programs.  Also included is
  1212. the Developer's Toolset including:  Ada Probe, a symbolic source level
  1213. debugger and program viewer; AdaXref, a cross-reference generator; AdaMake, a
  1214. recompilation aid; AdaReformat, a source reformatter.
  1215.  
  1216. Alsys currently has Ada bindings to POSIX, X-Windows (OSF Motif), and the
  1217. Generic Package of Elementary Functions for the Alsys Ada Software Development
  1218. Environment, running on 386 UNIX 386/486-based machines supported as both host
  1219. and target and running 386/ix or SCO UNIX.  They are also planning a binding
  1220. to SQL for  386/486 machines.
  1221.  
  1222. Host/Target:386/486 PC under IX UNIX, 386/486 PC under SCO UNIX
  1223.  
  1224. The Alsys Ada Software Development Environment for the IBM RS/6000 is a
  1225. production-quality Ada environment capable of handling very large Ada
  1226. applications.  Hosted on and targeted to the IBM RS/6000 workstation under
  1227. IBM's AIX operating system, the product includes the Compiler; Multi-Library
  1228. Environment, which provides a  powerful and flexible way to manage Ada
  1229. development efforts and share program units; Binder; Run-Time Executive; and
  1230. both a High and Low-Level Optimizer for improving code quality and
  1231. performance.  Also included is the Alsys Ada Toolset including Ada Probe,
  1232. symbolic source level debugger and program viewer; AdaXref, cross-reference
  1233. generator; AdaMake, recompilation aid; and AdaReformat, source reformatter.
  1234.  
  1235. Alsys has bindings currently available to the Generic Package of Elementary
  1236. Functions and to X-Windows (OSF Motif) for the Alsys Ada Development
  1237. Environment for the IBM RS/6000 running on any RISC System/6000 machine as
  1238. both host and target and running IBM's AIX operating system (Alsys's validated
  1239. Ada compiler #910809W1.11195).   Alsys also plans to develop a POSIX binding
  1240. for the RS/6000.
  1241.  
  1242. Host/Target:RISC System/6000 under AIX
  1243.  
  1244. The Alsys Ada Software Development Environment for SPARC Workstations is a
  1245. production-quality Ada environment capable of handling very large Ada
  1246. applications.  Hosted on any SPARC-based workstation under SunOS or SunView,
  1247. the product helps you realize the full potential of Ada on SPARC machines. The
  1248. product includes the Compiler (with High- and Low-Level Optimizers); Binder,
  1249. which supports unused subprogram elimination; Multi-Library system (Family,
  1250. Library, and Unit Managers) which provides a powerful and flexible way to
  1251. manage Ada development efforts and share program units;  AdaExec real-time
  1252. executive, for complete and efficient support for executing Ada programs; and
  1253. ISO-standard mathematical library.  Also included is the Alsys Ada Toolset
  1254. including AdaProbe, symbolic source level debugger and program viewer;
  1255. AdaXref, cross-reference  generator; AdaMake, recompilation aid; and
  1256. AdaReformat, source reformatter.
  1257.  
  1258. Bindings to the Generic Package of Elementary Functions and to OSF/Motif are
  1259. currently available for the Alsys Ada Software Development Environment running
  1260. on any SPARC-based Workstation as both host and target and running SunOS or
  1261. SunView.
  1262.  
  1263. Host/Target:SPARC under SUNOS
  1264.  
  1265. For more information, contact:Scott Garren, Alsys, Inc., 67 South Bedford
  1266.                         Street, Burlington, MA  01803-5152, USA;  Phone:
  1267.                         (617) 270-0030
  1268.  
  1269.  
  1270. Digital Equipment Corporation                              (Updated:  November
  1271. 1 992)
  1272.  
  1273. Digital Equipment Corporation has bindings available for GKS, PHIGS, SQL, and
  1274. OSF Motif for VAX Ada/VMS.  The Ada bindings are provided either as part of a
  1275. compiler product or the services/facilities that are provided by Digital and
  1276. its suppliers.
  1277.  
  1278. Host/Target:DEC VAX under VMS
  1279.  
  1280. For more information, contact:Mary Anne Cacciola, Digital Equipment
  1281.                         Corporation, 110 Spit Brook Road, Nashua, NH  03062,
  1282.                         USA; Phone:  (603) 881-1028
  1283.  
  1284.  
  1285. IBM                                                        (Updated:  November
  1286. 1 992)
  1287.  
  1288. IBM's AIX Ada/6000 product provides a binding to GPEF and IBM AIXWindows (X-
  1289. Windows ... not Motif).  It runs on all models of the IBM RISC System/6000
  1290. under the IBM AIX Version 3.2 operating system. See also entries for Systems
  1291. Engineering Research Corporation (SERC) and Advanced Technology Center (ATC)
  1292. for Motif, GKS or PHIGS bindings for use with IBM AIX Ada/6000 products.
  1293.  
  1294.  
  1295. The AIX Ada/6000 licensed programs (5706-291 and 5706-294) consist of an
  1296. optimizing compiler, a run-time environment, a symbolic debugger, an Ada
  1297. "makefile" generator for use in automating and minimizing recompilation, Ada
  1298. library management tools and Ada language bindings to some key AIX subsystems.
  1299. With the exception of some system-specific aspects of the language, the Ada
  1300. language for the AIX operating system is source compatible with the Ada
  1301. language supported by IBM licensed programs in VM/CMS and MVS.
  1302.  
  1303. Host/Target:IBM RISC System/6000 under the IBM AIX Version 3.2 operating
  1304.             system
  1305.  
  1306. This product conforms to the following standards:  ANSI/MIL-STD-1815A - Ada at
  1307. current level (1.11) of the ACVC test suite.
  1308.  
  1309. For more information, contact:Barry Lee, IBM Corporation, 844 Don Mills Road,
  1310.                         North York, Ontario, Canada  M3C 1V7; Phone:  (416)
  1311.                         448-3174; Fax: (416) 448-4810
  1312.  
  1313. Objective Interface Systems, Inc.                          (Updated:  November
  1314. 1 992)
  1315.  
  1316. Objective Interface Systems, Inc., has an Ada binding to X-windows (OSF Motif)
  1317. for its Screen Machine~ product.  The Screen Machine binding to Motif includes
  1318. a WYSIWYG drawing tool and an Ada code generator.
  1319.  
  1320. Host/Target:
  1321.  
  1322.       Sun SPARC/SunOS         Rational R1000/Delta    HP 9000/7XX; 8X7
  1323.       IBM RISC System/6000/AIXPC 386/486/ISC UNIX     HFSI WIS Workstation
  1324.       PC 286/386/486/MS-DOS   PC 386/486/SCO UNIX     DEC Ultrix; DEC VMS
  1325.  
  1326. For more information, contact:Phil Carrasco, Object Interface Systems, Inc.
  1327.                         1895 Preston White Drive, Suite 250, Reston, VA
  1328.                         22091-5448, USA; Phone: (703) 264-1900; Fax:
  1329.                         703-264-1721; email info@ois.com (internet)
  1330.  
  1331.  
  1332. SL Corporation                                              (Updated: November
  1333. 1 992)
  1334.  
  1335. SL Corporation's SL-GMS toolkit includes Ada bindings to GPEF, GPPF, POSIX,
  1336. SQL, TCP/IP, OSF/Motif, and Open Look.
  1337.  
  1338. SL-GMS is a toolkit for developing dynamic graphics screens for real-time or
  1339. highly interactive applications.  Non-programmers can design application
  1340. screens in a standard drawing-tool mode, connect them to real-time data
  1341. sources and animate screen objects to visualize changing data values.  SL-GMS
  1342. allows the design of custom "GISMOs" to input values or control the
  1343. application and supports MOTIF, OPEN LOOK and other X toolkit widgets.
  1344.  
  1345. SL-GMS is used extensively to provide real-time graphics for applications in
  1346. the fields of manufacturing, process control, network management, avionics and
  1347. financial tracking.
  1348.  
  1349. Host/Target:Validated Verdix and DEC compilers support SL-GMS for the
  1350.             following machines as both host and target:
  1351.  
  1352.  
  1353.       DEC-DECstation/ULTRIX 4.0DEC-VAXstation/ULTRIX 4.0
  1354.       DEC-VAXstation/VMS 5.4  DEC-VAXstation/VMS 5.5
  1355.  
  1356.       IBM-RS6000/AIX
  1357.  
  1358.       HP-9000/300/UNIX        HP-9000/400/UNIX
  1359.       HP-9000/800/UNIX        HP-9000/700/UNIX
  1360.  
  1361.       PC-386/IX UNIX          PC-386/SCO UNIX
  1362.       PC-386/Lynx             PC-386/0S2
  1363.       PC-386/System 5.4
  1364.  
  1365.       SGI-4D/IRIX 3.3
  1366.  
  1367.       Sun-3/SunOS 4.1         SunSPARC/SunOS 4.1
  1368.  
  1369.       88 Open/BCS Compliant
  1370.  
  1371. For more information, contact: Mike Meagher, SL Corporation, 240 Tamal Vista
  1372.                         Boulevard, Corte Madera, CA  94926, USA Phone: (415)
  1373.                         927-1724; Fax: (415) 927-2931
  1374.  
  1375.  
  1376. Sunrise Software International                                  (Updated:  May
  1377. 1 992)
  1378.  
  1379. Sunrise Software International's product, ezx, is a rapid application
  1380. development tool that automates the creation of graphical user interfaces for
  1381. OSF/MOTIF and generates C, UIL, or Ada.  ezx provides WYSIWYG screen layout;
  1382. color, font and pixmap editors; presentation tools and dialog management.  A
  1383. prototype can be developed in hours and using a script language similar to
  1384. Hypertalk, demonstrated to end-users before the first line of code is written.
  1385. Then portable C, UIL or Ada can be generated automatically.  Ada bindings are
  1386. provided.  The total code required to develop a GUI is reduced by
  1387. approximately 75%.   The appearance and behavior of the GUI is defined in an X
  1388. resource file which the application loads at run time.  This provides explicit
  1389. separation between the GUI and the computational core of the application. Thus
  1390. the GUI can be revised without recompiling (and retesting) the application.
  1391.  
  1392. ezx provides cost savings throughout the software development cycle, from
  1393. requirements analysis through design, code, test and maintenance.
  1394.  
  1395.  
  1396. Host/Target:DEC RISC under ULTRIX, DEC VAX under VMS, IBM 386 under UNIX, IBM
  1397.             RS 6000 under AIX, SGI under , SUN SPARC under UNIX
  1398.  
  1399. For more information, contact:Frederick Sells, Sunrise Software International,
  1400.                         170 Enterprise Center, Middletown, RI  02840, USA;
  1401.                         Phone:  401-847-7868
  1402.  
  1403. Systems Engineering Research Corporation (SERC)            (Updated:  November
  1404. 1 992)
  1405.  
  1406. SERC's Ada/MOTIF is a complete binding to X Window and OSF/Motif for the Ada
  1407. programming language that was based in part upon the SAIC/Unisys (STARS)
  1408. public domain bindings.  That work was leveraged as a starting point for this
  1409. development; many of the bug fixes and additional capabilities beyond the
  1410. public domain releases in Ada/MOTIF have been incorporated.  Most noteworthy
  1411. are the capabilities included in Ada/Motif for Ada tasking, callback
  1412. registration, memory leak detection/prevention and capabilities for developing
  1413. customized widgets.  Paramax/STARS considers Ada/Motif to be the commercial
  1414. version of their STARS bindings, according to SERC.
  1415.  
  1416. Ada/MOTIF is supported by the ALSYS, VERDIX, SUNAda, IBM Ada, and SGI Ada
  1417. compilers.
  1418.  
  1419.  
  1420. Host/Target:SUN 4, HP 300/400, HP 700, IBM RS 6000, SGI, 386
  1421.             SUN OS 4.1.1, SOLARIS 2.0 (coming), HPUX 8.0, SGI 3.2 & 4.0, IBM
  1422.             ATX 3.2, SCO 3.2
  1423.  
  1424. For more information, contact:Theo Kusiolek or Scott Cleveland, Systems
  1425.                         Engineering Research Corporation (SERC), 2555
  1426.                         Charleston Road, Mountain View, CA  94043, USA; Phone:
  1427.                         800-ADA-SERC or 415/962-9092; Fax:  415/962-0330;
  1428.                         E-mail:  Well!sercmail@apple.com.
  1429.  
  1430.  
  1431. TeleSoft                                                   (Updated:  November
  1432. 1 992)
  1433.  
  1434. TeleSoft's TeleUSE/Ada automates the creation of OSF/Motif graphical user
  1435. interfaces for Ada applications.  It includes a special version of the TeleUse
  1436. User Interface Management System -- which generates Ada source code -- and Ada
  1437. bindings to the TeleUSE run-time routines.
  1438.  
  1439. TeleUse/Ada tools allow a GUI to be prototyped and designed using a WYSIWYG
  1440. editor and a PDL, and also includes tools for debugging, generating production
  1441. code and maintaining the GUI.  TeleUse/Ada can save the developer up to 90
  1442. percent of the time required to hand code X Window System GUIs.
  1443.  
  1444. Host/Target:SPARC under UNIX, Sun-4 under UNIX
  1445.  
  1446.  
  1447. TeleSoft's TeleWindows is a set of Ada bindings to the X Window System and
  1448. OSF/Motif.  This includes Xlib, XT, X extensions Library, XT+, X miscellaneous
  1449. utilities, Motif widget set, XM, MWM, Motif resource manager.  It supports X-
  1450. 11 R4 and is not based on the public domain version.  It closely follows the C
  1451. Xlib syntax and allows Ada applications to co-exist with C applications.
  1452.  
  1453. Host/Target:IBM System/370 under VM/CMS
  1454.  
  1455. For more information, contact:Karen Johnson, TeleSoft, 5959 Cornerstone Court
  1456.                         West, San Diego, CA  92121-9891, USA; Phone:  (619)
  1457.                         457-2700
  1458.  
  1459. Verdix                                                          (Updated:  May
  1460. 1 992)
  1461.  
  1462. The Verdix Ada Development System (VADS), is a complete Ada Compiler System
  1463. offering a fully validated Ada compiler with chapter 13 support.  Verdix
  1464. supplies VADSself and VADScross.   VADSself provides a complete toolset for
  1465. self-targeted applications.  It easily interfaces to databases, windowing
  1466. systems and program management tools.  VADScross provides real-time support
  1467. for host-to-target system development.  VADScross produces small and fast
  1468. object code.  VADS is hosted on the largest number of platforms and targets
  1469. the greatest number of microprocessors.
  1470.  
  1471. Host/Target:88000 BCS under UNIX, DEC VAX under VMS / ULTRIX / UNIX,
  1472.             DECStation (RISC) under UNIX, DECSystem (RISC) under UNIX, HP 9000
  1473.             Series 300 under HP-UX  (UNIX), IBM PS/2 under AIX  (UNIX), IBM
  1474.             RISC System/6000 under AIX, SCO Systems V/386 (ABI) under UNIX,
  1475.             Sun SPARC systems under UNIX, Sun-3 systems under UNIX
  1476.  
  1477. Verdix AXI provides an Ada binding to the full Motif, Xt, and Xlib libraries.
  1478. The product works with user-supplied Motif 1.1 and X11R4 libraries regardless
  1479. of source.
  1480.  
  1481. Host/Target:DEC RISC under Ultrix, IBM RS6000 under AIX, MIPS under MIPSos,
  1482.             Sun-4 under SunOS, Sys V386 under ISC UNIX, Sys V386 under SCO
  1483.             UNIX
  1484.  
  1485. For more information, contact:Tim Ruhe, Verdix Corporation, 205 Van Buren,
  1486.                         Herndon, VA  22070, USA; Phone:  (703) 318-5800
  1487.  
  1488. Answer: Integrated Computer Solutions, Inc. (ICS) supplies Ada bindings to
  1489. Motif for a number of platforms and Ada compilers.  ICS also provides Builder
  1490. Xcessory, a Motif interface builder, which outputs Ada code usable with the
  1491. Ada bindings.  The product family is known collectively as the Ada Xcessories.
  1492.  
  1493. Integrated Computer Solutions, Inc. (ICS) 201 Broadway, Cambridge, MA  02139
  1494. USA info@ics.com   617/621-0060
  1495.  
  1496. -----------------------------------------------------------------------------
  1497. END OF PART FOUR
  1498.  
  1499.