[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
XCOLORS on MAC problem understood
- Subject: XCOLORS on MAC problem understood
- From: davidf(at)dfanning.com (David Fanning)
- Date: Fri, 30 Apr 1999 12:33:39 -0600
- Newsgroups: comp.lang.idl-pvwave
- Organization: Fanning Software Consulting
- Xref: news.doit.wisc.edu comp.lang.idl-pvwave:14582
I reported here several days ago that I had still not
been able to get to the bottom of a problem I was having
with my XCOLORS program running on Macintosh computers.
In particular, the program seemed to go into some kind
of a loop when I loaded new color vectors and informed
the calling program of that fact with a SEND_EVENT
mechanism. I reported that I could not get test programs
that used the SEND_EVENT mechanism to fail and that I
was at a loss as to how to narrow the problem down.
Fortunately, my report came to the attention of the
senior Macintosh programmer at RSI who encouraged me
to send the problem program to him to see if he could
get to the bottom of it. I am happy to report he did
just that in very short order. And I am very grateful.
It seems the problem lay not in my program or the
SEND_EVENT mechanism (thank goodness, because I like
this way of communicating between different widget
programs very much), but in a bit of obscure Mac
IDL code that attempted to update the windows after
every call to TVLCT.
Normally this code (although unnecessary and now
removed in future versions of IDL) causes no problems.
But it put me into a loop because I had draw widget
expose events turned on in my XCOLORS programs.
(In this case I use draw widget expose events to
make sure my XCOLORS program is always displaying
the correct set of colors in it's color table window.
Without color protection, widget display windows are
often at the mercy of whoever just loaded the
color table vectors. Most of my widget programs
have some kind of color protection mechanism built
into them so that I can always display colors
So XCOLORS would load the color vectors and I would
send an event. Then the Mac would update the window,
which caused an expose event, which caused XCOLORS
to load the color vectors, which caused another
SEND_EVENT, and so on.
The work around is to simply turn draw widget
expose events OFF for the XCOLORS window. The program
can be made to work by commenting out the fourth
line from the bottom of the XCOLORS program:
; Widget_Control, draw, Draw_Expose_Events=1
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: email@example.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155