home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / windows / x / motif / 7590 < prev    next >
Encoding:
Internet Message Format  |  1992-11-19  |  2.6 KB

  1. Path: sparky!uunet!paladin.american.edu!darwin.sura.net!tulane!uflorida!travis.csd.harris.com!cindy
  2. From: cindy@SSD.CSD.HARRIS.COM (Cindy Walters)
  3. Newsgroups: comp.windows.x.motif
  4. Subject: Problem with WM_DELETE_WINDOW callback
  5. Message-ID: <1egprpINNmph@travis.csd.harris.com>
  6. Date: 19 Nov 92 19:27:53 GMT
  7. Distribution: comp
  8. Organization: Harris Computers Systems Division, Fort Lauderdale,FL
  9. Lines: 50
  10. NNTP-Posting-Host: hcx1.ssd.csd.harris.com
  11.  
  12.  
  13. I am working on a Motif user interface to a large, multi-window
  14. application.  I'm experiencing a problem when I try to handle the window
  15. manager (mwm) "Close" system menu item - I do not want the window to be 
  16. immediately destroyed, rather I want to handle this situation in my own
  17. callback.  
  18.  
  19. I have been able to implement the behavior I want in a very simple, small
  20. Motif sample program which is very similar to the real application in the
  21. way it creates the various toplevel windows.  However, when I transfer this
  22. code to my large application, it does not work :-(  More specifically, I am 
  23. able to get the window to "do nothing" when I select the mwm "Close" system 
  24. menu, but the callback that I have set up for this protocol does not appear 
  25. to be getting called when the "Close" system menu item is selected.  Maybe 
  26. someone can give me some suggestions on what to try?  (I'm using X11R4 and 
  27. Motif 1.1.4.) 
  28.  
  29. Please email, and I will summarize if there is interest.  Thanks !
  30.  
  31.  
  32. Here's an example of the code I'm using:
  33.   Atom         wmDeleteWindow ;
  34.   Widget       shell, new_window ;
  35.   [...]
  36.   shell      = XtCreatePopupShell("mywindow", 
  37.                                   topLevelShellWidgetClass, AppShell, 
  38.                                   args, argcnt) ;
  39.   new_window = CreatemyWindow(shell) ;    /* create and manage widgets */
  40.                XtManageChild(new_window) ;
  41.                XtPopup(shell, XtGrabNone) ;
  42.  
  43.                  /* I want to handle the wm Close item. */
  44.                XtVaSetValues(shell, XmNdeleteResponse, XmDO_NOTHING, NULL);
  45.  
  46.                  /* Set up my callback for this protocol. */
  47.                wmDeleteWindow = XmInternAtom(XtDisplay(shell),
  48.                                             "WM_DELETE_WINDOW",
  49.                                             False) ;
  50.                XmAddWMProtocolCallback(shell,
  51.                                        wmDeleteWindow,
  52.                                        (XtCallbackProc)myCloseCB,  
  53.                                        (caddr_t)new_window) ;
  54.  
  55. I have a 'printf()' statement in myCloseCB() to see if it ever gets that
  56. far, but it never does.  
  57.  
  58. Any ideas?  Thanks for considering this :-)
  59.  
  60. Cindy Walters
  61. cindy@ssd.csd.harris.com
  62.