Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado
Peter Gallagher wrote: > > Does anyone know how to select a separate colour map for several > windows? I am currently working with 2 windows; I want one window > with a black and white colour map and the other with a red temp. > colour table. > > Any suggestions? > If you need both windows viewed simultaneously with their own colormaps, and you don't mind using half the available colors for each, then Liam's solution is the way to go. If you want to assign each window it's own complete colormap, and have that colormap restored when the cursor moves into the window, you can use the KBRD_FOCUS_EVENTS keyword when you create your draw widgets. You'll have to have a unique EVENT_PRO for the events from each of your draw widgets. Then in these event processing procedures put something like: PRO draw1_event, event name = strmid(tag_names(event, /structure_name), 7, 1000) case (name) of "KBRD_FOCUS": begin ; Entering program area so load colors if ( event.enter eq 1) then $ loadct, 0, /silent end ... END You should check out David Fanning's XWINDOWS routine, as it is a good example of this technique, though he does it slightly differently. I believe his web page has a tutorial on this as well: http://www.dfanning.com Hope this helps. Dave -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~ David S. Foster Univ. of California, San Diego Programmer/Analyst Brain Image Analysis Laboratory foster@bial1.ucsd.edu Department of Psychiatry (619) 622-5892 8950 Via La Jolla Drive, Suite 2240 La Jolla, CA 92037 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
Peter Gallagher wrote: > Does anyone know how to select a separate colour map for several > windows? I am currently working with 2 windows; I want one window > with a black and white colour map and the other with a red temp. > colour table. It's pretty easy: just split the color table in half as shown below. ;------------------------------------------ pro test ;- create two windows and save their window ids window, /free w1 = !d.window window, /free w2 = !d.window ;- assign colors for window 1 bottom1 = 0L ncolors1 = !d.table_size / 2 ;- assign colors for window 1 bottom2 = ncolors1 ncolors2 = !d.table_size - ncolors1 ;- display an image in the first window with a greyscale color table wset, w1 loadct, 0, bottom = bottom1, ncolors = ncolors1 tv, bytscl( dist(256), top = ncolors1 - 1 ) + byte( bottom1 ) ;- display an image in the second window with a red/white color table wset, w2 loadct, 3, bottom = bottom2, ncolors = ncolors2 tv, bytscl( dist(256), top = ncolors2 - 1 ) + byte( bottom2 ) end ;------------------------------------------ Cheers, Liam.