home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!ittc!dscott
- From: dscott@schlitz.ittc.wec.com (Dave Scott)
- Newsgroups: comp.windows.open-look
- Subject: Re: Problem with XV_KEY_DATA
- Message-ID: <DSCOTT.92Nov18160537@schlitz.ittc.wec.com>
- Date: 18 Nov 92 21:05:37 GMT
- References: <102323@bu.edu>
- Sender: news@ittc.wec.com
- Organization: Westinghouse - Simulators Division, Pittsburgh, PA
- Lines: 52
- In-reply-to: johnc@murray.bu.edu's message of 17 Nov 92 17:37:08 GMT
-
-
- In article <102323@bu.edu> johnc@murray.bu.edu (John Collins) writes:
-
- =>I have been writing an application with XView3. It seems that
- =>there is a problem with XV_KEY_DATA. My application creates a canvas
- =>with an XV_KEY_DATA field named CANVAS_XIMAGE_KEY. A button callback
- =>procedure (new_ximage()) changes the CANVAS_XIMAGE_KEY by calling a
- =>routine called make_canvas_ximage() (which returns an XImage *). This
- =>is the code
-
- =>void
- =>new_ximage(item, event)
- =>Panel_item item;
- =>Event *event;
- =>{
- => /* First remove the old ximage key. */
- => xv_set(canvas, XV_KEY_DATA_REMOVE, CANVAS_XIMAGE_KEY);
-
- => /* Get the new XImage and attach it to the canvas. */
- => xv_set(canvas, XV_KEY_DATA, CANVAS_XIMAGE_KEY, make_canvas_ximage() );
-
- => /* redisplay */
- => ...
- =>}
-
- =>The wierd thing about this code is that sometimes it goes off without a
- =>hitch, and sometimes it makes the program crash. The crash always happens
- =>when the routine make_canvas_ximage returns.
-
- Ahhhh! The key lies in the above statement that it works "sometimes."
-
- Try changing the line:
-
- xv_set(canvas, XV_KEY_DATA_REMOVE, CANVAS_XIMAGE_KEY);
-
- to:
-
- xv_set(canvas, XV_KEY_DATA_REMOVE, CANVAS_XIMAGE_KEY, NULL);
-
- Same change for the other xv_set().
-
- The NULL at the end of the xv_set() call will get you every time (er,
- well, sometimes :-).
-
- Shalom,
-
- -dave
-
- --
- David A. Scott - das@ils.com -OR- dscott@ittc.wec.com (Westinghouse)
- interLogic Software, Inc. "The shortest distance between
- (Currently on loan to Westinghouse) two points is under construction."
-