Re: Widgets and research [message #9248] |
Sun, 15 June 1997 00:00  |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
Mike Schienle writes:
> I wonder if David will have a class on using IDL's objects and the new
> drawing model in the near future. Perhaps a two-day class for those that
> are pretty familiar with the other aspects of IDL programming.
I'm teaching my first IDL 5.0 class next week. It reminds me of
the first Widget Programming class I taught all those many years
ago. (Has it really been over 6 years that we have been at this,
Mike!) I think Mike was in one of my very earliest classes. In
those days I was lucky to be five minutes ahead of the class.
The most important thing we learned was how important innovation
and humor can be in learning something new. We *all* learned
to write widget programs together!
I've spent the weekend writing object graphic programs, and I
must say I am starting to become impressed with the power of
them. It has been hard to change my thinking about
how graphics are displayed in a window. The whole Viewplane
Rectangle thing is a complete departure for me in how I've
written programs in the past. But once you get the idea, it
is amazingly powerful. I added the ability to preserve the
image aspect ratio to my XImage program, as well as the
ability to zoom in and out of the plot. The whole event
handler for the two floating zoom buttons amounted to 12
lines of code! I was *extremely* impressed.
I think I am going to like object-oriented programming as
much as I like widget programming. :-)
Cheers,
David
------------------------------------------------------------ --
David Fanning, Ph.D.
Fanning Software Consulting
Customizable IDL Programming Courses
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com
IDL 5 Reports: http://www.dfanning.com/documents/anomaly5.html
--
David Fanning, Ph.D.
Fanning Software Consulting
Customizable IDL Programming Courses
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com
IDL 5 Reports: http://www.dfanning.com/documents/anomaly5.html
|
|
|
Re: Widgets and research [message #9252 is a reply to message #9248] |
Sun, 15 June 1997 00:00   |
mgs
Messages: 144 Registered: March 1995
|
Senior Member |
|
|
In article <5nrmgq$jlm@news.aero.org>, meinel@altair.aero.org (Edward S.
Meinel) wrote:
> Jonathan Rogness <rogness@NO.sg1.SPAM.cr.usgs.gov> sez:
>
>> David Fanning wrote:
>>> When they are shown how easy it really is, they often start
>>> taking the view that widget programs are essential to their research
>>> and they don't know how they worked without them.
>>
>> I'd be interested in hearing some of these people speak up, just because
>> I'm curious about how exactly they incorporate widgets into their
>> research.
>
> OK, I'll bite. I started using widgets because I got tired of typing
> lots of commands on the command line. I wrote my own image processing
> widget since no existing program satisfied my needs. Now when I want
> to try a new algorithm, I write a .pro file for the main processing
> and add a couple of lines to the main widget to assign the processing
> to a menu. It has made algorithm development fast and easy.
I started using IDL's widgets when I was forced into IDL about six years
ago (I just realized it has been six years!) at a new job. I was into Motif
programming at the time, so it was natural to try doing the equivalent with
IDL that I was used to with Motif. I really got into it after taking a
class from David Fanning. David's class had a big impact on my programming.
Within a year of taking the class I won an IDL license from RSI when they
held an application development contest.
I wonder if David will have a class on using IDL's objects and the new
drawing model in the near future. Perhaps a two-day class for those that
are pretty familiar with the other aspects of IDL programming.
> On the other hand, I am reluctant to try IDL 5.beta because of all the
> reports of broken widgets. Do _any_ widgets developed with IDL 4 work
> under 5.0?
Yes, the majority of my widget applications are working fine. I've been
having problems with overlapping widget hierarchies, though. Particularly
when I let one hierarchy be its natural size, and force another hierarchy
to be the same size as the first using scroll keywords. RSI has asked for
some code to duplicate this which I will get to real soon now.
--
Mike Schienle Interactive Visuals
mgs@sd.cybernex.net http://ww2.sd.cybernex.net/~mgs/
|
|
|
Re: Widgets and research [message #9259 is a reply to message #9248] |
Sat, 14 June 1997 00:00   |
rivers
Messages: 228 Registered: March 1991
|
Senior Member |
|
|
In article <MPG.e0b229eb4d1d1e79896a6@news.frii.com>, davidf@dfanning.com (David Fanning) writes:
> Edward S. Meinel writes:
>
>> On the other hand, I am reluctant to try IDL 5.beta because of all the
>> reports of broken widgets. Do _any_ widgets developed with IDL 4 work
>> under 5.0?
>
> As a matter of fact, *all* of my widgets work under IDL 5.0.
> A few of them don't *look* exactly like they did under IDL 4,
> but the problems are aesthetic rather than functional. So
> far every one of them has worked like I expect it to.
I agree with David. I just finished converting a >3,000 line IDL widget
application to being "object oriented", using IDL Objects (but not Object
Graphics). The widgets worked perfectly under IDL 5.0 (Motif) with exactly the
same layout as 4.0 as far as I can see.
The only code which broke under IDL 5.0 was pickfile(). It used to return
"path+file" when selecting existing files, and only "file_name" when entering
the name of a new file. I think the old behavior was a bug.
IDL Objects really simplify complex widget programs, because so don't have to
create a "state" structure and stick in the uvalue of a top level widget. Just
put the object reference to "self" there instead. This is not entirely
obvious, and the Object manual does not have an example, so here is how I do
it.
;; File example__define.pro
function example::init
base = widget_base(uvalue=self)
self.widgets.base = base
self.widgets.exit = widget_button(base, value='Exit')
widget_control, base, /realize
xmanager, 'example::init', base, event='example_event', /no_block
return, 1
end
pro example_event, event
; Note: The main event handler CANNOT be an object method, since xmanager
; won't know how to call it as such. However, it only needs to be 4 lines
; long: retrieve the object reference and call the object method event
; handler, which will know about the objects data structure.
widget_control, event.top, get_uvalue=object
object->event, event
end
pro example::event, event
; This is the event handler which knows about the object
case event.id of
self.widgets.exit: begin
widget_control, event.top, /destroy
end
else: print, 'Unknown widget event'
endcase
end
pro example__define
widgets={example_widgets, base: 0L, exit: 0L}
data = fltarr(30)
t = {example, widgets: widgets, data: data}
end
____________________________________________________________
Mark Rivers (773) 702-2279 (office)
CARS (773) 702-9951 (secretary)
Univ. of Chicago (773) 702-5454 (FAX)
5640 S. Ellis Ave. (708) 922-0499 (home)
Chicago, IL 60637 rivers@cars.uchicago.edu (e-mail)
or:
Argonne National Laboratory (630) 252-0422 (office)
Building 434A (630) 252-0405 (lab)
9700 South Cass Avenue (630) 252-1713 (beamline)
Argonne, IL 60439 (630) 252-0443 (FAX)
|
|
|
|
|
|
|
Re: Widgets and research [message #9374 is a reply to message #9263] |
Tue, 17 June 1997 00:00  |
David Foster
Messages: 341 Registered: January 1996
|
Senior Member |
|
|
David Fanning wrote:
>
> Edward S. Meinel writes:
>
>> On the other hand, I am reluctant to try IDL 5.beta because of all the
>> reports of broken widgets. Do _any_ widgets developed with IDL 4 work
>> under 5.0?
>
> As a matter of fact, *all* of my widgets work under IDL 5.0.
> A few of them don't *look* exactly like they did under IDL 4,
> but the problems are aesthetic rather than functional. So
> far every one of them has worked like I expect it to.
>
In IDL 5.0 the implementation of modal widgets is completely different
than it was previously, and this has major implications for how
widget applications work together when one or more of them are modal.
In our lab we often have a series of apps that are called
successively, and I'm finding that all the "rules" are different
as far as what combinations are possible.
For example, the following scenario is ok:
MODAL_WID --> NON_MODAL_WID --> MODAL_WID
(modal widget calls non-modal widget etc.).
But the following is NOT ok:
MODAL_WID --> MODAL_WID --> NON_MODAL_WID --> MODAL_WID
When you do this the last modal widget does not generate any events.
This use to work in IDL 4.0.1, now it doesn't. I'm finding other
similar problems related to modal widgets. If you're lucky, you
don't use modal widgets often, and so won't notice these problems.
(Check out XMANAGER.PRO to see the comments about how the
implementation of modal widgets has changed.)
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 2200
La Jolla, CA 92037
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
"I have this theory that if we're told we're bad,
then that's the only idea we'll ever have.
But maybe if we are surrounded in beauty,
someday we will become what we see." - Jewel Kilcher
|
|
|
Re: Widgets and research [message #9375 is a reply to message #9263] |
Tue, 17 June 1997 00:00  |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
Mike Schienle writes:
>>> I wonder if David will have a class on using IDL's objects and the new
>>> drawing model in the near future. Perhaps a two-day class for those that
>>> are pretty familiar with the other aspects of IDL programming.
>>
>> I'm teaching my first IDL 5.0 class next week.
>
> I don't suppose you'd like to put a syllabus online somewhere.
I am in the process of completely revamping my IDL Training Courses
page, so you should see it soon. Plus, courses have the bad habit
of revamping themselves rather dramatically until I have taught them
several times. :-)
I *am* planning on teaching IDL advanced courses in Europe in
October. If anyone on that side of the Atlantic would like
IDL 5 training around that time, please let me know. I might
have a pretty good idea of what I'm talking about by then. At
least I *hope* so! :-)
Cheers,
David
------------------------------------------------------------ ----------
David Fanning, Ph.D.
Fanning Software Consulting
Customizable IDL Programming Courses
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com
IDL 5 Reports: http://www.dfanning.com/documents/anomaly5.html
|
|
|
Re: Widgets and research [message #9380 is a reply to message #9263] |
Tue, 17 June 1997 00:00  |
mgs
Messages: 144 Registered: March 1995
|
Senior Member |
|
|
In article <MPG.e0e5f94d52a2d649896af@news.frii.com>, davidf@dfanning.com
(David Fanning) wrote:
> Mike Schienle writes:
>
>> I wonder if David will have a class on using IDL's objects and the new
>> drawing model in the near future. Perhaps a two-day class for those that
>> are pretty familiar with the other aspects of IDL programming.
>
> I'm teaching my first IDL 5.0 class next week.
I don't suppose you'd like to put a syllabus online somewhere.
> It reminds me of
> the first Widget Programming class I taught all those many years
> ago. (Has it really been over 6 years that we have been at this,
> Mike!)
Yup. For IDL, at least. I was talking to someone about a job I had a couple
years ago, when I realized "couple" was equivalent to six.
> I think Mike was in one of my very earliest classes. ... We *all* learned
> to write widget programs together!
March of '94. The widget programming book was only half the size it is now.
UValues were just being exploited, Handles were on the horizon.
> I've spent the weekend writing object graphic programs, and I
> must say I am starting to become impressed with the power of
> them. ...
>
> I think I am going to like object-oriented programming as
> much as I like widget programming. :-)
I'm looking forward to getting up to speed in the objects and new graphics
areas.
--
Mike Schienle mgs@sd.cybernex.net Interactive Visuals
Data Visualization for Science and Engineering using IDL and PV-WAVE
|
|
|