home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / windows / x / 14456 < prev    next >
Encoding:
Text File  |  1992-07-27  |  1.9 KB  |  50 lines

  1. Newsgroups: comp.windows.x
  2. Path: sparky!uunet!europa.asd.contel.com!darwin.sura.net!jvnc.net!yale.edu!yale!mintaka.lcs.mit.edu!hal!brself
  3. From: brself@hal.gnu.ai.mit.edu (Ben Self)
  4. Subject: Trapping BadWindow Errors?
  5. Message-ID: <brself.712270104@hal>
  6. Sender: news@mintaka.lcs.mit.edu
  7. Organization: MIT Laboratory for Computer Science
  8. Date: Mon, 27 Jul 1992 20:48:24 GMT
  9. Lines: 39
  10.  
  11.  
  12. When I began looking for ways to safe-guard my communications sent via
  13. XSendEvent I ran acrossed the following entry in XFAQ:
  14.  
  15. > ----------------------------------------------------------------------
  16. > Subject: 132)  How do I check whether a window ID is valid?
  17. > My program has the ID of a window on a remote display. I want to check whether
  18. > the window exists before doing anything with it.
  19. >         Because X is asynchronous, there isn't a guarantee that the window 
  20. > would still exist between the time that you got the ID and the time you sent 
  21. > an event to the window or otherwise manipulated it. What you should do is send
  22. > the event without checking, but install an error handler to catch any
  23. > BadWindow errors, which would indicate that the window no longer exists.
  24. > This scheme will work except on the [rare] occasion that the original window
  25. > has been destroyed and its ID reallocated to another window.
  26. > [courtesy Ken Lee (klee@wsl.dec.com), 4/90]
  27. > ----------------------------------------------------------------------
  28.  
  29. This is a great suggestion; unfortunately, the documentation for the XError
  30. interfaces is frightfully *unclear* and *unspecific*.  
  31.  
  32. Could someone please outline the specifics that are required to trap
  33. BadWindow Errors (preferably from a given widget or procedure)
  34.  
  35. and tell me which of the various error interface mechanisms are involved:
  36.  
  37.   Xt:
  38.          XtAppErrorMsg
  39.          XtAppError
  40.  
  41.    Xlib:
  42.          XSetErrorHandler
  43.          XSetIOErrorHandler
  44.  
  45.  
  46. Great appreciation in advance (I bow to the wizards of all they survey)
  47.