aw@romeo.cs.duke.edu (Angus Wang) (03/01/89)
I have written a graphic widget for visualization of data and have come into a problem that I think involves the server. Here's the overall set up of things: Program A: Uses my graphic widget which is a subclass of Simple class. It maintains bojects and segments of the things to be drawn. Sort of like a 'vi' for graphical data. Probram B: A text editor for the ascii numerals of the data points. It uses the Text widget from the athena widgets. It allows the user to start up other editor windows as shell widgets. What is usually done is that the user starts up Program B witha file coontaining several data sets. Then selects a group of points by using the first button on the mouse. This places converts the numbers to a string of text and places the points into XCUTBUFFER0 which should be global. Then entering the window for Program A, one can hit a paste button which takes the points from XCUTBUFFER0 and converts them back into numbers, then plots the points. Up to this point things work like they should. The problem comes in when I use the running Program B to startup a toplevelShellWidget. What I am trying to do is find the region of interest within the displayed data set, and then select these points by rubber-banding a box around them and then paste these points into the topLevelShellWidget (another copy of Program B) to find the exact x & y values for the points comprising the region of interest. What happens instead is that when I paste into the topLevelShellWidget, I get the original entire data set pased into it, not the points that I selected from the graphic widget(Program A). I know that the points are getting selected because I added a debug command button to program A which only does one thing, which is : fprintf(stderr, "buffer= '%s'\n", XFetchBytes(display, &number)); and when I hit this button, it gives me the correct numbers. Somehow it appears that the editor program is remembering what was selected from its other window and overwriting the buffer from the graphic widget. All this is on a Sun 4 using a color monitor, X Windows Version 11 release 3 with no patches. Unsing the Xsun server. Has any one ever experienced anything like this or know if any of the pathces would fix this. Or posssibly at least suggest some reason why this might be happening. here's some misc. info that might be helpful: Program A : applicationshellwidget | vpane widget / | \ box widget label graphic widget | widget command widgets Program B : applicationshellwidget | vpane widget / | \ box widget label text widget | widget command widgets And a scenerio : 12 + * +----------+ | ....... |3.0 | 9 | : * :<= selected |6.0 |<== entire data set | : : points |9.0 | 6 | : * : |12.0 | plot of entire data set==> | :.....: | | 3 | * +----------+ +---------- 1 2 3 4 then pasting into another editor window : +----------+ +----------+ |3.0 |<= what results |6.0 | |6.0 | |9.0 | |9.0 | | | |12.0 | what should have been the result =>| | | | | | +----------+ +----------+ Any help would be greatly appreciated. Angus Wang ========================================================================== Department of Computer Science, Duke University, Durham, NC 27706 UUCP : decvax!duke!aw CSNET: aw@duke ARPA : aw@cs.duke.edu
swick@ATHENA.MIT.EDU (Ralph R Swick) (03/02/89)
> Somehow it > appears that the editor program is remembering what was selected from > its other window and overwriting the buffer from the graphic widget. Looks like your programs are getting confused between cut buffers and selections. The R3 Xaw Text widget can use either cut buffers or selections and by default does both, but prefers to paste the PRIMARY selection if it exists, falling back to the cut buffer only if no PRIMARY selection exists. You could specify a 'translations' resource for the Text widget to cause it to ignore selections (at least on the insert-selection operation) or you could modify your program to always use selections instead of the cut buffer. The first is easy for quick-and-dirty, the second will probably give you more satisfaction in the long run.