Re: Passing info and destroying widgets... [message #15881 is a reply to message #15879] |
Mon, 21 June 1999 00:00   |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
Liam Gumley (Liam.Gumley@ssec.wisc.edu) gives us an
example of a program that can record the last instance
of a button push in a non-blocking, non-modal widget
when he writes:
> "Robert S. Mallozzi" wrote:
>> I believe you must use XMANAGER in blocking mode for
>> this technique to work.
>
> Here's an example which works in non-blocking mode:
No question it works. But I would argue that it works
for all the wrong reasons and is a *terrible* programming
practice in almost every instance. I mean, you can write
an object method that returns a data pointer too, but
by doing so you violate every tenet of good object programming
practice, in which the data should be encapsulated and
unseen by the outside world. Sucking the pointer out of
a widget program, except perhaps in the hands of just the
best programmers, is a practice that is guaranteed, it
seems to me, to get most of the rest of us in a hell of
a lot of trouble.
If you are going to recommend this, at the very least
teach people how to use HEAP_GC at the same time because
I'll bet a ton of money there will be leaking memory
right and left!
As for me, I'm sticking to widget programs that clean
themselves up and don't leave the user holding the bag,
er, pointer. :-)
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
|
|
|