comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: PRINTER device changed in IDL 6
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: PRINTER device changed in IDL 6 [message #38297] Mon, 01 March 2004 12:04
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
R.G. Stockwell writes:

> Perhaps (or more likely certainly) I am missing the point, but why load colours inside the
> Printer device? I have always loaded the colors I want before I set the
> set_plot device (usually because I load my very pretty colors in my startup file, and I
> almost never change them). Simply reversing the order of the two calls (tvscl and set_plot)
> makes the error go away.

Well, 16.7 million colors to choose from, some of us are
just not happy with 256, no matter how pretty they are. :-)

No, I'm kidding. This comes up for me because I try
to write programs that are device independent. That is
to say, they work the same way (use the same colors, lay
out their graphics in the same place, align their fonts
in the same way, etc.) no matter what graphics output
device they happen to find themselves running on. In
practice I only care about these: X, WIN, Z, PS, PRINTER.
But even that is challenge enough to cause me to break
out in cold sweats in the middle of the night. (Throw in
MAC and I shake so much I pretty much can't even serve
in tennis.)

But the point is, I try to make these programs self-contained
and smart. In the business I'm in, I can't ever rely on the
environment being set up like mine (or even set up properly
according to my instructions, but that's for another day).
I *have* to load colors inside my programs if I expect them
to work properly. So, as you can see, it's a bit of a problem.

At the moment I am working around this problem by "protecting"
TVLCT commands like this:

IF !D.Name EQ 'PRINTER' THEN BEGIN
Set_Plot, 'Z', /Copy
TVLCT, theColor, theIndex
Set_Plot, 'PRINTER', /Copy
ENDIF ELSE TVLCT, theColor, theIndex

But that seems like a lot of fluff for a single TVLCT command!

Maybe I'll just follow the same path I used when I had to write
25 lines of code every time I wanted to use a TV command, and just
write my own color loading routine. :-)

Cheers,

David



--
David Fanning, Ph.D.
Fanning Software Consulting
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: PRINTER device changed in IDL 6 [message #38298 is a reply to message #38297] Mon, 01 March 2004 11:40 Go to previous message
R.G. Stockwell is currently offline  R.G. Stockwell
Messages: 363
Registered: July 1999
Senior Member
"David Fanning" <david@dfanning.com> wrote in message news:MPG.1aad3936a81870259896bf@news.frii.com...
> David Fanning writes:
>
>> Here is the test program:
>>
>> PRO Test
>> thisDevice = !D.Name
>> Set_Plot, 'PRINTER'
>> TVLCT, 255, 255, 0, 200
>> Set_Plot, thisDevice
>> END

I see the error too (IDL 6 - Win), and in fact TVLCT is always
broken after this call, even if I'm in my 'win' device. I have to reenter IDL
to be able to use it.
Perhaps (or more likely certainly) I am missing the point, but why load colours inside the
Printer device? I have always loaded the colors I want before I set the
set_plot device (usually because I load my very pretty colors in my startup file, and I
almost never change them). Simply reversing the order of the two calls (tvscl and set_plot)
makes the error go away.

Cheers,
bob
Re: PRINTER device changed in IDL 6 [message #38299 is a reply to message #38298] Mon, 01 March 2004 11:13 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
David Fanning writes:

> Here is the test program:
>
> PRO Test
> thisDevice = !D.Name
> Set_Plot, 'PRINTER'
> TVLCT, 255, 255, 0, 200
> Set_Plot, thisDevice
> END
>
> This code runs fine in all versions of IDL prior to 6.0.
> But it fails in 6.0 (on both my Windows machines, at least)
> with the following error:
>
> % TVLCT: Error creating device colortable.
>
> Oddly, this program does not cause an error the FIRST time
> it is run in a new IDL session, only on subsequent times!!

I was wrong about it running in earlier versions of IDL.
It fails reliably in all of them if you run the program
enough times (2).

According to RSI this is listed as a known "defect",
but I am apparently the first person in recorded history
to run into it in practice. Not much motivation to get to
the bottom of it, as I understand it, unless more people
complain. I guess I'm talking to all three of you who
have downloaded the programs that go with my book. :-)

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: PRINTER device changed in IDL 6 [message #38307 is a reply to message #38299] Mon, 01 March 2004 01:19 Go to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
David Fanning <david@dfanning.com> writes:

> Folks,
>
> I have been getting odd e-mail from folks complaining about
> programs that have been working for years. I've traced it
> back to an unannounced change in the PRINTER device in IDL 6.0.
> I'm trying now to see how widespread this phenomenon is before
> I report the problem to RSI.
>
> Here is the test program:
...
> Oddly, this program does not cause an error the FIRST time
> it is run in a new IDL session, only on subsequent times!!
> Very strange.

Works fine running multiple times on Linux.

IDL> print, !version
{ x86 linux unix linux 6.0 Jun 27 2003 32 64}
IDL> test
IDL> test
IDL> test
IDL>

Craig
Re: PRINTER device changed in IDL 6 [message #38316 is a reply to message #38307] Sat, 28 February 2004 12:04 Go to previous message
Kenneth P. Bowman is currently offline  Kenneth P. Bowman
Messages: 585
Registered: May 2000
Senior Member
In article <MPG.1aaa7530922b1c3f9896ba@news.frii.com>,
David Fanning <david@dfanning.com> wrote:

> PRO Test
> thisDevice = !D.Name
> Set_Plot, 'PRINTER'
> TVLCT, 255, 255, 0, 200
> Set_Plot, thisDevice
> END

I don't have any problems running this program (renamed test_printer)
multiple times under OS X.

csrp3> idl
IDL Version 6.0, Mac OS X (darwin ppc m32). (c) 2003, Research Systems,
Inc.
Installation number: 8233-12-6.
Licensed for use by: DEPARTMENT OF METEOROLOGY

% Compiled module: MAKE_PATH.
IDL> test_printer
% Compiled module: TEST_PRINTER.
IDL> test_printer
IDL> test_printer

Ken
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: amoeba/mpfit/etc with a quantized variable?
Next Topic: Statistic codes: Significance level

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 13:49:33 PDT 2025

Total time taken to generate the page: 0.01075 seconds