[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Multiple widgetized windows in one application



Stein Vidar Hagfors Haugan (steinhh@ulrik.uio.no) writes:

> Most widget programs that I've written have been using a
> single event handling routine, structured along the lines
> of:

I'm not going to get into a pissing contest with Stein
Vidar over how to write IDL widget programs. Lord knows, 
I'm smart enough to know when I'm over-matched even if
I'm not smart enough to keep my mouth shut all the time.

But I will say this. If you know what you are doing,
you can pretty much write widget programs any way you
please. If you need evidence, open up just about any
program in the lib directory and look at that spaghetti
code. Older programs written by David Stern (the
founder of RSI) tend to use a lot of WIDGET_EVENT calls. 
I say, the more power to him. David CLEARLY knows
what he is doing. 

But I would argue that if any of us run-of-the-mill 
hackers put a WIDGET_EVENT command in our program, 
then we have written a program that pretty much
ought to be shot.

For most of us (who are not programmers, but scientists
who have a job to do), anything that makes our programs
easier to build and easier to maintain has to be a 
positive development. In my experience teaching a LOT
of people to write IDL programs, I've found that
having many event handlers rather than one big event
handler leads to significantly better programs.

I'm not saying it has to be this way. I'm saying
that until you know exactly what you are doing, you
are more likely to write better programs this way
than any other way.

Some of you have heard me tell the Barry Lopez
story "Directions" in my classes:

 "You may have come across a detailed set of instructions,
  a map...At first glance it seems excellent, the best
  a man is capable of. But your confidence is misplaced.
  Throw it out. It is too thin, it's not the sort of map 
  that can be followed by a man who knows what he is doing. 
  The coyote...even the crow...will regard it with suspicion."

A man (or woman) who knows what they are doing will find
the right way to write a widget program *without* a map
and without advice from so-called IDL experts. :-)

Cheers,

David

-- 
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155