Path: utzoo!attcan!uunet!lll-winken!ames!mailrus!cornell!rochester!udel!burdvax!coltoff From: coltoff@PRC.Unisys.COM (Joel Coltoff) Newsgroups: comp.windows.x Subject: Help needed with GC's Keywords: I'm stuck again Message-ID: <8937@burdvax.PRC.Unisys.COM> Date: 13 Jan 89 21:55:22 GMT Distribution: na Organization: Unisys/Paoli Research Center, Paoli, PA 19301 Lines: 35 First let me apologize if you get two copies of this. I cancelled the first one but in looking at news queues it doesn't appear as though it worked. Now to the matter at hand. I stuck on a small problem with GC's and could use somebody's help. My interface uses a text widget to supply information to and get responses from a user. In some cases I need to the user to highlight multiple lines. This means I need to manage the highlighting and slection mechanisms by myself. The current code looks like this. * * /* * Copy the selected line to itself but invert the area. */ gc = DefaultGCOfScreen(XtScreen(w)); XSetFunction(XtDisplay(w), gc, GXcopyInverted); XCopyArea(XtDisplay(w), XtWindow(w), XtWindow(w), gc, Xpos, Ypos, barWidth, barHeight, Xpos, Ypos ); XSetFunction(XtDisplay(w), gc, GXcopy); /* * Mark the current line as being selected. */ * * This works just great in monochrome but gives the wrong result in color. What I want to know is what is quickest way to swap the foreground and background pixels of a given rectangle that works on both monochrome and color monitors? It is possible, but not convenient, to get the text on the slected line and redraw it. Thanks in advance. -- - Joel {psuvax1,sdcrdcf}!burdvax!coltoff (UUCP) coltoff@burdvax.prc.unisys.com (ARPA)